rphrp1985 commited on
Commit
215396c
1 Parent(s): f8673b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -13,12 +13,7 @@ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
13
  token=os.getenv('token')
14
  print('token = ',token)
15
 
16
- from transformers import AutoTokenizer, AutoModelForCausalLM
17
 
18
- model_id = "CohereForAI/c4ai-command-r-plus-4bit"
19
-
20
- tokenizer = AutoTokenizer.from_pretrained(model_id, token= token)
21
- model = AutoModelForCausalLM.from_pretrained(model_id, token= token)
22
 
23
 
24
 
@@ -31,6 +26,12 @@ def respond(
31
  temperature,
32
  top_p,
33
  ):
 
 
 
 
 
 
34
  messages = [{"role": "user", "content": "Hello, how are you?"}]
35
  input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
36
  ## <BOS_TOKEN><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Hello, how are you?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
 
13
  token=os.getenv('token')
14
  print('token = ',token)
15
 
 
16
 
 
 
 
 
17
 
18
 
19
 
 
26
  temperature,
27
  top_p,
28
  ):
29
+ from transformers import AutoTokenizer, AutoModelForCausalLM
30
+
31
+ model_id = "CohereForAI/c4ai-command-r-plus-4bit"
32
+
33
+ tokenizer = AutoTokenizer.from_pretrained(model_id, token= token)
34
+ model = AutoModelForCausalLM.from_pretrained(model_id, token= token)
35
  messages = [{"role": "user", "content": "Hello, how are you?"}]
36
  input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
37
  ## <BOS_TOKEN><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Hello, how are you?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>