waleyWang commited on
Commit
b76ffc6
·
verified ·
1 Parent(s): ad23950

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -127,7 +127,7 @@ def load_llama_model(model_path, device, context_size, cache_dir):
127
 
128
  tokenizer = transformers.AutoTokenizer.from_pretrained(
129
  model_path,
130
- cache_dir=cache_dir, # 使用传入的 cache_dir
131
  model_max_length=context_size if context_size > orig_ctx_len else orig_ctx_len,
132
  padding_side="right",
133
  use_fast=False,
@@ -176,7 +176,7 @@ def main(args):
176
  bert_model, bert_tokenizer = load_bert(args.bert_model)
177
  product_label = run_bert(args.question, bert_model, bert_tokenizer)
178
  response = f"Product Prediction Result:\n{product_label}"
179
- print("Generating response:", response) # 添加调试信息
180
  return response
181
 
182
  elif predicted_label == 'Label_1':
@@ -186,7 +186,7 @@ def main(args):
186
  prompt = prompt_no_input.format_map({"instruction": args.question})
187
  output = plan_response(prompt=prompt)
188
  response = f"Computational Planning Result:\n{output}"
189
- print("Generating response:", response) # 添加调试信息
190
  return response
191
 
192
  else:
@@ -196,12 +196,12 @@ def main(args):
196
  prompt = prompt_no_input.format_map({"instruction": args.question})
197
  output = code_response(prompt=prompt)
198
  response = f"Code Generation Result:\n{output}"
199
- print("Generating response:", response) # 添加调试信息
200
  return response
201
 
202
  except Exception as e:
203
  error_msg = f"Error occurred: {str(e)}"
204
- print("Error:", error_msg) # 添加错误日志
205
  return error_msg
206
 
207
  def process_question(question):
 
127
 
128
  tokenizer = transformers.AutoTokenizer.from_pretrained(
129
  model_path,
130
+ cache_dir=cache_dir,
131
  model_max_length=context_size if context_size > orig_ctx_len else orig_ctx_len,
132
  padding_side="right",
133
  use_fast=False,
 
176
  bert_model, bert_tokenizer = load_bert(args.bert_model)
177
  product_label = run_bert(args.question, bert_model, bert_tokenizer)
178
  response = f"Product Prediction Result:\n{product_label}"
179
+ print("Generating response:", response)
180
  return response
181
 
182
  elif predicted_label == 'Label_1':
 
186
  prompt = prompt_no_input.format_map({"instruction": args.question})
187
  output = plan_response(prompt=prompt)
188
  response = f"Computational Planning Result:\n{output}"
189
+ print("Generating response:", response)
190
  return response
191
 
192
  else:
 
196
  prompt = prompt_no_input.format_map({"instruction": args.question})
197
  output = code_response(prompt=prompt)
198
  response = f"Code Generation Result:\n{output}"
199
+ print("Generating response:", response)
200
  return response
201
 
202
  except Exception as e:
203
  error_msg = f"Error occurred: {str(e)}"
204
+ print("Error:", error_msg)
205
  return error_msg
206
 
207
  def process_question(question):