Update app.py
Browse files
app.py
CHANGED
@@ -21,15 +21,14 @@ nf4_config = BitsAndBytesConfig(
|
|
21 |
bnb_4bit_use_double_quant=True,
|
22 |
bnb_4bit_compute_dtype=torch.bfloat16
|
23 |
)
|
24 |
-
|
25 |
model_id = "CohereForAI/c4ai-command-r-v01"
|
26 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
27 |
-
model = AutoModelForCausalLM.from_pretrained(
|
28 |
# load_in_8bit=True,
|
29 |
-
|
30 |
# attn_implementation="flash_attention_2",
|
31 |
# torch_dtype = torch.bfloat16,
|
32 |
-
|
33 |
)
|
34 |
|
35 |
# replace_linears_in_hf(model)
|
|
|
21 |
bnb_4bit_use_double_quant=True,
|
22 |
bnb_4bit_compute_dtype=torch.bfloat16
|
23 |
)
|
|
|
24 |
model_id = "CohereForAI/c4ai-command-r-v01"
|
25 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
26 |
+
model = AutoModelForCausalLM.from_pretrained(model_id,
|
27 |
# load_in_8bit=True,
|
28 |
+
quantization_config=nf4_config,
|
29 |
# attn_implementation="flash_attention_2",
|
30 |
# torch_dtype = torch.bfloat16,
|
31 |
+
device_map="auto"
|
32 |
)
|
33 |
|
34 |
# replace_linears_in_hf(model)
|