Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,17 +4,17 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
|
| 4 |
|
| 5 |
model_name = "DiscoResearch/DiscoLM_German_7b_v1"
|
| 6 |
bnb_config = BitsAndBytesConfig(
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
|
| 19 |
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
| 20 |
|
|
|
|
| 4 |
|
| 5 |
model_name = "DiscoResearch/DiscoLM_German_7b_v1"
|
| 6 |
bnb_config = BitsAndBytesConfig(
|
| 7 |
+
load_in_4bit=True,
|
| 8 |
+
bnb_4bit_quant_type="nf4",
|
| 9 |
+
bnb_4bit_compute_dtype=torch.float16,
|
| 10 |
+
)
|
| 11 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
| 12 |
+
model_name,
|
| 13 |
+
quantization_config=bnb_config,
|
| 14 |
+
device_map="auto",
|
| 15 |
+
trust_remote_code=True,
|
| 16 |
+
token=True,
|
| 17 |
+
)
|
| 18 |
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
|
| 19 |
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
| 20 |
|