Akjava commited on
Commit
53ad32d
Β·
1 Parent(s): 376d532
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -15,7 +15,7 @@ model_id = "microsoft/Phi-3-mini-128k-instruct"
15
  device = "auto" # torch.device("cuda" if torch.cuda.is_available() else "cpu")
16
  dtype = torch.bfloat16
17
 
18
- tokenizer = AutoTokenizer.from_pretrained(model_id, token=huggingface_token)
19
 
20
 
21
  import time
@@ -72,7 +72,7 @@ def generate_text(prompt, system_message="You are a helpful assistant."):
72
  global histories
73
 
74
  model = AutoModelForCausalLM.from_pretrained(
75
- model_id, token=huggingface_token ,torch_dtype=dtype,device_map=device
76
  )
77
  #print(system_message)
78
  text_generator = pipeline("text-generation", model=model, tokenizer=tokenizer,torch_dtype=dtype,device_map=device) #pipeline has not to(device)
 
15
  device = "auto" # torch.device("cuda" if torch.cuda.is_available() else "cpu")
16
  dtype = torch.bfloat16
17
 
18
+ tokenizer = AutoTokenizer.from_pretrained(model_id)#, token=huggingface_token)
19
 
20
 
21
  import time
 
72
  global histories
73
 
74
  model = AutoModelForCausalLM.from_pretrained(
75
+ model_id ,torch_dtype=dtype,device_map=device # token=huggingface_token
76
  )
77
  #print(system_message)
78
  text_generator = pipeline("text-generation", model=model, tokenizer=tokenizer,torch_dtype=dtype,device_map=device) #pipeline has not to(device)