Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,19 +4,20 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
| 4 |
import transformers
|
| 5 |
import torch
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def falcon(input_text):
|
| 9 |
-
model = "tiiuae/falcon-40b"
|
| 10 |
|
| 11 |
-
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 12 |
-
pipeline = transformers.pipeline(
|
| 13 |
-
"text-generation",
|
| 14 |
-
model=model,
|
| 15 |
-
tokenizer=tokenizer,
|
| 16 |
-
torch_dtype=torch.bfloat16,
|
| 17 |
-
trust_remote_code=True,
|
| 18 |
-
device_map="auto",
|
| 19 |
-
)
|
| 20 |
sequences = pipeline(
|
| 21 |
input_text, # "Was ist das höchste Gebäude in der Welt?"
|
| 22 |
max_length=200,
|
|
|
|
| 4 |
import transformers
|
| 5 |
import torch
|
| 6 |
|
| 7 |
+
model = "tiiuae/falcon-7b"
|
| 8 |
+
|
| 9 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 10 |
+
pipeline = transformers.pipeline(
|
| 11 |
+
"text-generation",
|
| 12 |
+
model=model,
|
| 13 |
+
tokenizer=tokenizer,
|
| 14 |
+
torch_dtype=torch.bfloat16,
|
| 15 |
+
trust_remote_code=True,
|
| 16 |
+
device_map="auto",
|
| 17 |
+
)
|
| 18 |
|
| 19 |
def falcon(input_text):
|
|
|
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
sequences = pipeline(
|
| 22 |
input_text, # "Was ist das höchste Gebäude in der Welt?"
|
| 23 |
max_length=200,
|