Spaces:
Paused
Paused
truongghieu
commited on
Commit
•
b27ed41
1
Parent(s):
212571c
Update app.py
Browse files
app.py
CHANGED
@@ -16,11 +16,12 @@ bnb_config = BitsAndBytesConfig(
|
|
16 |
|
17 |
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
18 |
# Load model in this way if use GPU
|
19 |
-
if (
|
20 |
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True, quantization_config=bnb_config)
|
21 |
-
|
22 |
model = AutoModelForCausalLM.from_pretrained("truongghieu/deci-finetuned", trust_remote_code=True)
|
23 |
# Move the model to the GPU if available
|
|
|
24 |
|
25 |
generation_config = GenerationConfig(
|
26 |
penalty_alpha=0.6,
|
|
|
16 |
|
17 |
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
18 |
# Load model in this way if use GPU
|
19 |
+
if torch.cuda.is_available():
|
20 |
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True, quantization_config=bnb_config)
|
21 |
+
else:
|
22 |
model = AutoModelForCausalLM.from_pretrained("truongghieu/deci-finetuned", trust_remote_code=True)
|
23 |
# Move the model to the GPU if available
|
24 |
+
model.to(device)
|
25 |
|
26 |
generation_config = GenerationConfig(
|
27 |
penalty_alpha=0.6,
|