Update app.py
Browse files
app.py
CHANGED
@@ -79,8 +79,8 @@ tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
79 |
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", trust_remote_code=True)
|
80 |
|
81 |
# Ensure the model is on the GPU
|
82 |
-
|
83 |
-
|
84 |
|
85 |
# Create Hugging Face Pipeline with the specified model and tokenizer
|
86 |
hf_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
|
|
79 |
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", trust_remote_code=True)
|
80 |
|
81 |
# Ensure the model is on the GPU
|
82 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
83 |
+
model.to(device)
|
84 |
|
85 |
# Create Hugging Face Pipeline with the specified model and tokenizer
|
86 |
hf_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer)
|