Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
andreea-popescu-reef committed Sep 4, 2024
1 parent 8f0216c commit fde42c3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_push_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ jobs:
cd src/compute_horde_prompt_gen
ls
docker build -t "${{ IMAGE_NAME }}" .
docker build -t $IMAGE_NAME .
# docker run -v ./output/:/app/output/ "${{ IMAGE_NAME }}" --number_of_batches 5 --number_of_prompts_per_batch 30 --uuids uuid1,uuid2,uuid3,uuid4,uuid5
# docker run -v ./output/:/app/output/ $IMAGE_NAME --number_of_batches 5 --number_of_prompts_per_batch 30 --uuids uuid1,uuid2,uuid3,uuid4,uuid5
10 changes: 5 additions & 5 deletions .github/workflows/smoke_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
with:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}

- name: Install dependencies
run: |
# python -m pip install --upgrade 'pdm>=2.12,<3'
# pdm install
python -m pip install transformers torch
# - name: Install dependencies
# run: |
# # python -m pip install --upgrade 'pdm>=2.12,<3'
# # pdm install
# python -m pip install transformers torch

- name: Run Test
run: |
Expand Down
14 changes: 8 additions & 6 deletions src/compute_horde_prompt_gen/model.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import torch
import numpy as np
import logging
from transformers import (
AutoTokenizer,
AutoModelForCausalLM,
)

from prompt import PROMPT_ENDING

Expand All @@ -15,14 +11,20 @@ def __init__(self):
pass

def generate(self, prompts: list[str], num_return_sequences: int, **_kwargs):
return torch.rand(len(prompts) * num_return_sequences)
return np.random.rand(len(prompts) * num_return_sequences)

def decode(self, _output):
return f"COPY PASTE INPUT PROMPT {PROMPT_ENDING} Here is the list of prompts:\nHow are you?\nDescribe something\nCount to ten\n"


class GenerativeModel:
def __init__(self, model_path: str, quantize: bool = False):
import torch
from transformers import (
AutoTokenizer,
AutoModelForCausalLM,
)

quantization_config = None
if quantize:
from transformers import BitsAndBytesConfig
Expand Down

0 comments on commit fde42c3

Please sign in to comment.