Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,13 @@
|
|
| 1 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
| 6 |
-
load_in_4bit=False # Força desabilitar quantização
|
| 7 |
-
)
|
| 8 |
|
| 9 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
| 10 |
model = AutoModelForCausalLM.from_pretrained(
|
| 11 |
-
|
| 12 |
-
device_map="auto",
|
| 13 |
-
trust_remote_code=True
|
| 14 |
-
quantization_config=bnb_config
|
| 15 |
)
|
| 16 |
# Pipeline de texto
|
| 17 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
|
|
|
| 1 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 2 |
|
| 3 |
+
model_name = "TheBloke/phi-2-GPTQ"
|
| 4 |
|
| 5 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
|
|
|
|
|
| 6 |
|
|
|
|
| 7 |
model = AutoModelForCausalLM.from_pretrained(
|
| 8 |
+
model_name,
|
| 9 |
+
device_map="auto", # ou "cuda:0" se for GPU
|
| 10 |
+
trust_remote_code=True
|
|
|
|
| 11 |
)
|
| 12 |
# Pipeline de texto
|
| 13 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|