aekpic877 commited on
Commit
3e61735
·
verified ·
1 Parent(s): ec9d3dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -4,9 +4,11 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
4
 
5
  # Load your model from Hugging Face Transformers
6
  model_name = "deepseek-ai/DeepSeek-V2-Lite"
7
- tokenizer = AutoTokenizer.from_pretrained(model_name)
8
- model = AutoModelForCausalLM.from_pretrained(model_name)
9
 
 
 
 
 
10
  # Define a function to use the model
11
  def math_inference(input_text):
12
  inputs = tokenizer(input_text, return_tensors="pt")
 
4
 
5
  # Load your model from Hugging Face Transformers
6
  model_name = "deepseek-ai/DeepSeek-V2-Lite"
 
 
7
 
8
+ tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
9
+ model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True, torch_dtype=torch.bfloat16).cpu()
10
+ model.generation_config = GenerationConfig.from_pretrained(model_name)
11
+ model.generation_config.pad_token_id = model.generation_config.eos_token_id
12
  # Define a function to use the model
13
  def math_inference(input_text):
14
  inputs = tokenizer(input_text, return_tensors="pt")