theodotus commited on
Commit
afae51e
1 Parent(s): dd6a7c6

Use mt5-xl-lm-adapt

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -34,7 +34,7 @@ class TokenIteratorStreamer:
34
  def generate_prompt(history):
35
  prompt = ""
36
  for chain in history[:-1]:
37
- prompt += f"<human>: {chain[0]}\n<bot>: {chain[1]}{end_token}\n"
38
  prompt += f"<human>: {history[-1][0]}\n<bot>:"
39
  tokens = tokenizer.convert_ids_to_tokens(tokenizer.encode(prompt))
40
  return tokens
@@ -52,7 +52,7 @@ def generate(streamer, history):
52
  [tokens],
53
  beam_size=1,
54
  max_decoding_length = 256,
55
- repetition_penalty = 1.2,
56
  callback = stepResultCallback
57
  )
58
  return results
@@ -60,7 +60,7 @@ def generate(streamer, history):
60
 
61
 
62
  translator = ctranslate2.Translator("model", intra_threads=2)
63
- tokenizer = AutoTokenizer.from_pretrained("openlm-research/open_llama_7b", use_fast=False)
64
  end_token = "</s>"
65
  end_token_id = tokenizer.encode(end_token)[0]
66
 
 
34
  def generate_prompt(history):
35
  prompt = ""
36
  for chain in history[:-1]:
37
+ prompt += f"<human>: {chain[0]}\n<bot>: {chain[1]}\n"
38
  prompt += f"<human>: {history[-1][0]}\n<bot>:"
39
  tokens = tokenizer.convert_ids_to_tokens(tokenizer.encode(prompt))
40
  return tokens
 
52
  [tokens],
53
  beam_size=1,
54
  max_decoding_length = 256,
55
+ repetition_penalty = 1.8,
56
  callback = stepResultCallback
57
  )
58
  return results
 
60
 
61
 
62
  translator = ctranslate2.Translator("model", intra_threads=2)
63
+ tokenizer = AutoTokenizer.from_pretrained("DKYoon/mt5-xl-lm-adapt")
64
  end_token = "</s>"
65
  end_token_id = tokenizer.encode(end_token)[0]
66