Spaces:
Runtime error
Runtime error
Commit
·
a8c8525
1
Parent(s):
efbada4
Update app.py
Browse files
app.py
CHANGED
@@ -1,29 +1,16 @@
|
|
1 |
|
2 |
|
3 |
-
from transformers import AutoTokenizer
|
4 |
-
import transformers
|
5 |
import torch
|
6 |
from huggingface_hub import login
|
7 |
|
8 |
login(token="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")
|
9 |
|
10 |
-
|
|
|
11 |
|
12 |
-
|
13 |
-
pipeline = transformers.pipeline(
|
14 |
-
"text-generation",
|
15 |
-
model=model,
|
16 |
-
torch_dtype=torch.float16,
|
17 |
-
device_map="auto",
|
18 |
-
)
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
num_return_sequences=1,
|
25 |
-
eos_token_id=tokenizer.eos_token_id,
|
26 |
-
max_length=200,
|
27 |
-
)
|
28 |
-
for seq in sequences:
|
29 |
-
print(f"Result: {seq['generated_text']}")
|
|
|
1 |
|
2 |
|
|
|
|
|
3 |
import torch
|
4 |
from huggingface_hub import login
|
5 |
|
6 |
login(token="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")
|
7 |
|
8 |
+
# Use a pipeline as a high-level helper
|
9 |
+
from transformers import pipeline
|
10 |
|
11 |
+
pipe = pipeline("text-generation", model="meta-llama/Llama-2-7b-chat-hf")
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
print("Providing input to the pipeline.....")
|
14 |
+
|
15 |
+
response = pipe("Hello, how are you?")
|
16 |
+
print(response)
|
|
|
|
|
|
|
|
|
|
|
|