Update app.py
Browse files
app.py
CHANGED
@@ -9,11 +9,16 @@ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
|
9 |
# pip install 'git+https://github.com/huggingface/transformers.git'
|
10 |
|
11 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
|
|
|
|
|
|
|
|
12 |
token=os.getenv('token')
|
13 |
print('token = ',token)
|
14 |
model_id = "CohereForAI/c4ai-command-r-plus"
|
15 |
tokenizer = AutoTokenizer.from_pretrained(model_id, token= token)
|
16 |
-
model = AutoModelForCausalLM.from_pretrained(model_id, token= token)
|
17 |
|
18 |
# Format message with the command-r-plus chat template
|
19 |
messages = [{"role": "user", "content": "Hello, how are you?"}]
|
|
|
9 |
# pip install 'git+https://github.com/huggingface/transformers.git'
|
10 |
|
11 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
12 |
+
|
13 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
14 |
+
|
15 |
+
bnb_config = BitsAndBytesConfig(load_in_8bit=True)
|
16 |
+
|
17 |
token=os.getenv('token')
|
18 |
print('token = ',token)
|
19 |
model_id = "CohereForAI/c4ai-command-r-plus"
|
20 |
tokenizer = AutoTokenizer.from_pretrained(model_id, token= token)
|
21 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, token= token, quantization_config=bnb_config)
|
22 |
|
23 |
# Format message with the command-r-plus chat template
|
24 |
messages = [{"role": "user", "content": "Hello, how are you?"}]
|