Jellyfish042 commited on
Commit
8a0d82d
·
1 Parent(s): 15b2f1f
Files changed (1) hide show
  1. app.py +15 -10
app.py CHANGED
@@ -209,14 +209,21 @@ def run_evaluation(text: str, progress=gr.Progress()):
209
  text = result # Use cleaned text
210
 
211
  try:
212
- # Step 1: Evaluate Qwen (using cached model)
213
- progress(0, desc="Evaluating with Qwen3...")
214
-
215
- # Get token count for prediction
216
  qwen_inputs = _qwen_tokenizer(text, return_tensors="pt", add_special_tokens=False)
217
  qwen_token_count = qwen_inputs["input_ids"].shape[-1]
218
  qwen_predicted_time = _stats_manager.predict_time("qwen", qwen_token_count)
219
 
 
 
 
 
 
 
 
 
 
 
220
  result_qwen = evaluate_hf_single_sample(_qwen_model, _qwen_tokenizer, text, bos_mode="add_newline_token")
221
 
222
  # Save stats and print comparison
@@ -227,12 +234,10 @@ def run_evaluation(text: str, progress=gr.Progress()):
227
  print(f"Qwen3 completed in {result_qwen['inference_time']:.2f}s")
228
 
229
  # Step 2: Evaluate RWKV7 (using cached model)
230
- progress(0, desc="Evaluating with RWKV7...")
231
-
232
- # Get token count for prediction
233
- rwkv_tokenized = _rwkv_tokenizer.encode(text)
234
- rwkv_token_count = len(rwkv_tokenized.ids if hasattr(rwkv_tokenized, "ids") else rwkv_tokenized)
235
- rwkv_predicted_time = _stats_manager.predict_time("rwkv", rwkv_token_count)
236
 
237
  result_rwkv = evaluate_rwkv7_single_sample(_rwkv_model, _rwkv_tokenizer, text)
238
 
 
209
  text = result # Use cleaned text
210
 
211
  try:
212
+ # Get token counts for prediction first
 
 
 
213
  qwen_inputs = _qwen_tokenizer(text, return_tensors="pt", add_special_tokens=False)
214
  qwen_token_count = qwen_inputs["input_ids"].shape[-1]
215
  qwen_predicted_time = _stats_manager.predict_time("qwen", qwen_token_count)
216
 
217
+ rwkv_tokenized = _rwkv_tokenizer.encode(text)
218
+ rwkv_token_count = len(rwkv_tokenized.ids if hasattr(rwkv_tokenized, "ids") else rwkv_tokenized)
219
+ rwkv_predicted_time = _stats_manager.predict_time("rwkv", rwkv_token_count)
220
+
221
+ # Step 1: Evaluate Qwen (using cached model)
222
+ if qwen_predicted_time is not None:
223
+ progress(0, desc=f"Evaluating with Qwen3... (estimated: {qwen_predicted_time:.1f}s)")
224
+ else:
225
+ progress(0, desc="Evaluating with Qwen3...")
226
+
227
  result_qwen = evaluate_hf_single_sample(_qwen_model, _qwen_tokenizer, text, bos_mode="add_newline_token")
228
 
229
  # Save stats and print comparison
 
234
  print(f"Qwen3 completed in {result_qwen['inference_time']:.2f}s")
235
 
236
  # Step 2: Evaluate RWKV7 (using cached model)
237
+ if rwkv_predicted_time is not None:
238
+ progress(0, desc=f"Evaluating with RWKV7... (estimated: {rwkv_predicted_time:.1f}s)")
239
+ else:
240
+ progress(0, desc="Evaluating with RWKV7...")
 
 
241
 
242
  result_rwkv = evaluate_rwkv7_single_sample(_rwkv_model, _rwkv_tokenizer, text)
243