thanglekdi commited on
Commit
cf978fc
·
1 Parent(s): ad43a4e

test deepseek

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -47,6 +47,11 @@ def respond(
47
 
48
  import torch
49
  from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
 
 
 
 
 
50
  def deepseek(
51
  message,
52
  history: list[tuple[str, str]],
@@ -54,11 +59,7 @@ def deepseek(
54
  max_tokens,
55
  temperature,
56
  top_p):
57
- model_name = "deepseek-ai/deepseek-math-7b-instruct"
58
- tokenizer = AutoTokenizer.from_pretrained(model_name)
59
- model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")
60
- model.generation_config = GenerationConfig.from_pretrained(model_name)
61
- model.generation_config.pad_token_id = model.generation_config.eos_token_id
62
 
63
  # messages = [
64
  # {"role": "user", "content": "what is the integral of x^2 from 0 to 2?\nPlease reason step by step, and put your final answer within \\boxed{}."}
 
47
 
48
  import torch
49
  from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
50
+ model_name = "deepseek-ai/deepseek-math-7b-instruct"
51
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
52
+ model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")
53
+ model.generation_config = GenerationConfig.from_pretrained(model_name)
54
+ model.generation_config.pad_token_id = model.generation_config.eos_token_id
55
  def deepseek(
56
  message,
57
  history: list[tuple[str, str]],
 
59
  max_tokens,
60
  temperature,
61
  top_p):
62
+
 
 
 
 
63
 
64
  # messages = [
65
  # {"role": "user", "content": "what is the integral of x^2 from 0 to 2?\nPlease reason step by step, and put your final answer within \\boxed{}."}