Spaces:
Runtime error
Runtime error
storresbusquets
commited on
Commit
•
6dccfc2
1
Parent(s):
f5630bc
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ access_token = os.getenv("Llama2")
|
|
10 |
def greet(token, text):
|
11 |
|
12 |
model = "meta-llama/Llama-2-7b-chat-hf"
|
13 |
-
tokenizer = AutoTokenizer.from_pretrained(model, token=access_token)
|
14 |
|
15 |
pipeline = transformers.pipeline(
|
16 |
"text-generation",
|
@@ -23,15 +23,14 @@ def greet(token, text):
|
|
23 |
do_sample=True,
|
24 |
top_k=10,
|
25 |
num_return_sequences=1,
|
26 |
-
|
27 |
token=access_token
|
28 |
)
|
29 |
|
30 |
llm = HuggingFacePipeline(pipeline = pipeline, model_kwargs = {'temperature':0})
|
31 |
|
32 |
template = """
|
33 |
-
Write a summary of the following text
|
34 |
-
Return your response which covers the key points of the text.
|
35 |
```{text}```
|
36 |
SUMMARY:
|
37 |
"""
|
|
|
10 |
def greet(token, text):
|
11 |
|
12 |
model = "meta-llama/Llama-2-7b-chat-hf"
|
13 |
+
tokenizer = AutoTokenizer.from_pretrained(model, token=access_token,use_safetensors=False)
|
14 |
|
15 |
pipeline = transformers.pipeline(
|
16 |
"text-generation",
|
|
|
23 |
do_sample=True,
|
24 |
top_k=10,
|
25 |
num_return_sequences=1,
|
26 |
+
eos_token_id=tokenizer.eos_token_id,
|
27 |
token=access_token
|
28 |
)
|
29 |
|
30 |
llm = HuggingFacePipeline(pipeline = pipeline, model_kwargs = {'temperature':0})
|
31 |
|
32 |
template = """
|
33 |
+
Write a concise summary of the following text.
|
|
|
34 |
```{text}```
|
35 |
SUMMARY:
|
36 |
"""
|