guoday commited on
Commit
5e4e1da
1 Parent(s): a55f745

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -27,6 +27,7 @@ if torch.cuda.is_available():
27
  model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
28
  tokenizer = AutoTokenizer.from_pretrained(model_id)
29
  tokenizer.use_default_system_prompt = False
 
30
 
31
 
32
  @spaces.GPU
@@ -38,7 +39,7 @@ def generate(
38
  temperature: float = 0.6,
39
  top_p: float = 0.9,
40
  top_k: int = 50,
41
- repetition_penalty: float = 1.2,
42
  ) -> Iterator[str]:
43
  global total_count
44
  total_count += 1
@@ -63,10 +64,9 @@ def generate(
63
  {"input_ids": input_ids},
64
  streamer=streamer,
65
  max_new_tokens=max_new_tokens,
66
- do_sample=True,
67
  top_p=top_p,
68
  top_k=top_k,
69
- temperature=temperature,
70
  num_beams=1,
71
  repetition_penalty=repetition_penalty,
72
  eos_token_id=32021
 
27
  model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
28
  tokenizer = AutoTokenizer.from_pretrained(model_id)
29
  tokenizer.use_default_system_prompt = False
30
+
31
 
32
 
33
  @spaces.GPU
 
39
  temperature: float = 0.6,
40
  top_p: float = 0.9,
41
  top_k: int = 50,
42
+ repetition_penalty: float = 1,
43
  ) -> Iterator[str]:
44
  global total_count
45
  total_count += 1
 
64
  {"input_ids": input_ids},
65
  streamer=streamer,
66
  max_new_tokens=max_new_tokens,
67
+ do_sample=False,
68
  top_p=top_p,
69
  top_k=top_k,
 
70
  num_beams=1,
71
  repetition_penalty=repetition_penalty,
72
  eos_token_id=32021