research14 commited on
Commit
230d9ba
·
1 Parent(s): 3036c83

testing vicuna model

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -5,8 +5,8 @@ import os
5
  import openai
6
 
7
  # Load the Vicuna 7B model and tokenizer
8
- vicuna_tokenizer = AutoTokenizer.from_pretrained("lmsys/vicuna-7b-v1.5")
9
- vicuna_model = AutoModelForCausalLM.from_pretrained("lmsys/vicuna-7b-v1.5")
10
 
11
  # Load the LLaMA 7b model and tokenizer
12
  llama_tokenizer = AutoTokenizer.from_pretrained("daryl149/llama-2-7b-chat-hf")
@@ -60,7 +60,7 @@ def vicuna_respond(tab_name, message, chat_history):
60
  print('Vicuna - Prompt + Context:')
61
  print(formatted_prompt)
62
  input_ids = vicuna_tokenizer.encode(formatted_prompt, return_tensors="pt")
63
- output_ids = vicuna_model.generate(input_ids, do_sample=True, max_length=100, num_beams=5, no_repeat_ngram_size=2)
64
  bot_message = vicuna_tokenizer.decode(output_ids[0], skip_special_tokens=True)
65
  # Remove formatted prompt from bot_message
66
  bot_message = bot_message.replace(formatted_prompt, '')
 
5
  import openai
6
 
7
  # Load the Vicuna 7B model and tokenizer
8
+ vicuna_tokenizer = AutoTokenizer.from_pretrained("lmsys/vicuna-7b-v1.3")
9
+ vicuna_model = AutoModelForCausalLM.from_pretrained("lmsys/vicuna-7b-v1.3")
10
 
11
  # Load the LLaMA 7b model and tokenizer
12
  llama_tokenizer = AutoTokenizer.from_pretrained("daryl149/llama-2-7b-chat-hf")
 
60
  print('Vicuna - Prompt + Context:')
61
  print(formatted_prompt)
62
  input_ids = vicuna_tokenizer.encode(formatted_prompt, return_tensors="pt")
63
+ output_ids = vicuna_model.generate(input_ids, do_sample=True, max_length=1024, num_beams=5, no_repeat_ngram_size=2)
64
  bot_message = vicuna_tokenizer.decode(output_ids[0], skip_special_tokens=True)
65
  # Remove formatted prompt from bot_message
66
  bot_message = bot_message.replace(formatted_prompt, '')