Spaces:
Sleeping
Sleeping
Commit ·
5d75ab3
1
Parent(s): c91ff29
Add requirements0
Browse files
app.py
CHANGED
|
@@ -7,13 +7,16 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
|
| 7 |
# ----------------------
|
| 8 |
model_name = "bigcode/starcoder2-7b"
|
| 9 |
|
| 10 |
-
bnb_config = BitsAndBytesConfig(load_in_8bit=True) # 8-bit لتوفير VRAM وتسريع التوليد
|
| 11 |
|
| 12 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
model = AutoModelForCausalLM.from_pretrained(
|
| 14 |
model_name,
|
| 15 |
-
|
| 16 |
-
|
| 17 |
trust_remote_code=True
|
| 18 |
)
|
| 19 |
model.eval()
|
|
|
|
| 7 |
# ----------------------
|
| 8 |
model_name = "bigcode/starcoder2-7b"
|
| 9 |
|
|
|
|
| 10 |
|
| 11 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 12 |
+
model_name,
|
| 13 |
+
trust_remote_code=True
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
model = AutoModelForCausalLM.from_pretrained(
|
| 17 |
model_name,
|
| 18 |
+
torch_dtype=torch.float16,
|
| 19 |
+
|
| 20 |
trust_remote_code=True
|
| 21 |
)
|
| 22 |
model.eval()
|