mkthoma commited on
Commit
281c8a9
1 Parent(s): c7b0633

app update

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -3,7 +3,7 @@ from transformers import pipeline
3
  from transformers import AutoModelForCausalLM, AutoTokenizer
4
 
5
  model_path = "finetuned_phi2"
6
- model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True)
7
  tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
8
 
9
 
@@ -12,7 +12,7 @@ def generate(question, context):
12
  system_message = "You are a question answering chatbot. Provide a clear and detailed explanation"
13
  prompt = f"[INST] <<SYS>>\n{system_message}\n<</SYS>>\n\n {question} [/INST]" # replace the command here with something relevant to your task
14
 
15
- num_new_tokens = 500 # change to the number of new tokens you want to generate
16
  # Count the number of tokens in the prompt
17
  num_prompt_tokens = len(tokenizer(prompt)['input_ids'])
18
  # Calculate the maximum length for the generation
 
3
  from transformers import AutoModelForCausalLM, AutoTokenizer
4
 
5
  model_path = "finetuned_phi2"
6
+ model = AutoModelForCausalLM.from_pretrained(model_path, low_cpu_mem_usage=True, trust_remote_code=True)
7
  tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
8
 
9
 
 
12
  system_message = "You are a question answering chatbot. Provide a clear and detailed explanation"
13
  prompt = f"[INST] <<SYS>>\n{system_message}\n<</SYS>>\n\n {question} [/INST]" # replace the command here with something relevant to your task
14
 
15
+ num_new_tokens = 200 # change to the number of new tokens you want to generate
16
  # Count the number of tokens in the prompt
17
  num_prompt_tokens = len(tokenizer(prompt)['input_ids'])
18
  # Calculate the maximum length for the generation