Update app.py
Browse files
app.py
CHANGED
@@ -339,6 +339,11 @@ from langchain_huggingface import HuggingFacePipeline
|
|
339 |
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
|
340 |
import gradio as gr
|
341 |
|
|
|
|
|
|
|
|
|
|
|
342 |
# Define HuggingFace LLM
|
343 |
def create_llm():
|
344 |
model_name = "Qwen/Qwen2.5-7B-Instruct-1M"
|
@@ -348,7 +353,7 @@ def create_llm():
|
|
348 |
task="text-generation",
|
349 |
model=model,
|
350 |
tokenizer=tokenizer,
|
351 |
-
|
352 |
max_new_tokens=500,
|
353 |
)
|
354 |
return HuggingFacePipeline(pipeline=llm_pipeline)
|
|
|
339 |
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
|
340 |
import gradio as gr
|
341 |
|
342 |
+
import torch
|
343 |
+
print(torch.cuda.is_available()) # Check if a GPU is available
|
344 |
+
a = torch.Tensor([1]).cuda() # Should succeed without errors
|
345 |
+
print(a)
|
346 |
+
|
347 |
# Define HuggingFace LLM
|
348 |
def create_llm():
|
349 |
model_name = "Qwen/Qwen2.5-7B-Instruct-1M"
|
|
|
353 |
task="text-generation",
|
354 |
model=model,
|
355 |
tokenizer=tokenizer,
|
356 |
+
device=0,
|
357 |
max_new_tokens=500,
|
358 |
)
|
359 |
return HuggingFacePipeline(pipeline=llm_pipeline)
|