Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,13 +12,17 @@ model_id = "eastwind/grok-1-hf-4bit"
|
|
12 |
tokenizer_id = "Xenova/grok-1-tokenizer"
|
13 |
# tokenizer_path = "./"
|
14 |
# eos_token_id = 7
|
15 |
-
|
|
|
|
|
|
|
|
|
16 |
DESCRIPTION = """
|
17 |
# Welcome to Tonic's Grok-1
|
18 |
"""
|
19 |
|
20 |
# tokenizer = AutoTokenizer.from_pretrained(model_id, device_map="auto", trust_remote_code=True)
|
21 |
-
tokenizer = LlamaTokenizerFast.from_pretrained(tokenizer_id, device_map="cuda", trust_remote_code=True)
|
22 |
model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True, device_map="cuda", trust_remote_code=True)
|
23 |
|
24 |
def format_prompt(user_message, system_message="You are Grok-1, an AI language model created by Tonic-AI. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and follow ethical guidelines and promote positive behavior.\n\n"):
|
|
|
12 |
tokenizer_id = "Xenova/grok-1-tokenizer"
|
13 |
# tokenizer_path = "./"
|
14 |
# eos_token_id = 7
|
15 |
+
quantization_config = BitsAndBytesConfig(
|
16 |
+
load_in_4bit=True,
|
17 |
+
bnb_4bit_use_double_quant=True,
|
18 |
+
bnb_4bit_compute_dtype=torch.bfloat16
|
19 |
+
)
|
20 |
DESCRIPTION = """
|
21 |
# Welcome to Tonic's Grok-1
|
22 |
"""
|
23 |
|
24 |
# tokenizer = AutoTokenizer.from_pretrained(model_id, device_map="auto", trust_remote_code=True)
|
25 |
+
tokenizer = LlamaTokenizerFast.from_pretrained(tokenizer_id, device_map="cuda", quantization_config = quantization_config, trust_remote_code=True)
|
26 |
model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True, device_map="cuda", trust_remote_code=True)
|
27 |
|
28 |
def format_prompt(user_message, system_message="You are Grok-1, an AI language model created by Tonic-AI. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and follow ethical guidelines and promote positive behavior.\n\n"):
|