Skip to content

Commit

Permalink
Adding container files
Browse files Browse the repository at this point in the history
  • Loading branch information
blackbera committed Mar 30, 2024
1 parent 79716b0 commit b509e39
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04

RUN apt-get update && apt-get install -y \
python3 \
python3-pip

RUN pip3 install torch transformers

WORKDIR /app

COPY run_models.py /app/

CMD ["python3", "run_models.py"]
Binary file added img/nosana_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions run_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

models = [
"mistralai/Mistral-7B-Instruct-v0.2", # Mistral
"Qwen/Qwen1.5-72B-Chat", # Qwen 1.5
"meta-llama/Llama-2-7b", # Llama 2
"databricks/dbrx-instruct", # DBRX
"01-ai/Yi-34B-200K", # Yi
"xai-org/grok-1", # Grok
]

prompts = [
"What is the capital of France?",
"Explain the concept of artificial intelligence in simple terms.",
"Write a short story about a robot who dreams of becoming human.",
"What are the benefits of regular exercise?",
"How can we reduce our carbon footprint to combat climate change?",
]

for model_name in models:
print(f"Running model: {model_name}")
print("---")

tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)

for prompt in prompts:
input_ids = tokenizer.encode(prompt, return_tensors="pt")
output = model.generate(input_ids, max_length=100)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)

print(f"Prompt: {prompt}")
print(f"Generated text: {generated_text}")
print("---")

print("\n")

0 comments on commit b509e39

Please sign in to comment.