Spaces:
Runtime error
Runtime error
updated
Browse files
app.py
CHANGED
|
@@ -9,12 +9,12 @@ from transformers import pipeline
|
|
| 9 |
|
| 10 |
token = os.getenv("HUGGINGFACE_API_TOKEN")
|
| 11 |
pipe = pipeline("text-generation", "meta-llama/Meta-Llama-3-8B-Instruct", torch_dtype=torch.bfloat16, device_map="auto", token=token)
|
| 12 |
-
response = pipe(chat, max_new_tokens=512)
|
| 13 |
|
| 14 |
pipe.to('cuda')
|
| 15 |
|
| 16 |
@spaces.GPU
|
| 17 |
def generate(prompt):
|
|
|
|
| 18 |
r = response[0]['generated_text'][-1]['content']
|
| 19 |
return r
|
| 20 |
|
|
|
|
| 9 |
|
| 10 |
token = os.getenv("HUGGINGFACE_API_TOKEN")
|
| 11 |
pipe = pipeline("text-generation", "meta-llama/Meta-Llama-3-8B-Instruct", torch_dtype=torch.bfloat16, device_map="auto", token=token)
|
|
|
|
| 12 |
|
| 13 |
pipe.to('cuda')
|
| 14 |
|
| 15 |
@spaces.GPU
|
| 16 |
def generate(prompt):
|
| 17 |
+
response = pipe(chat, max_new_tokens=512)
|
| 18 |
r = response[0]['generated_text'][-1]['content']
|
| 19 |
return r
|
| 20 |
|