Keeby-smilyai commited on
Commit
5f67d55
·
verified ·
1 Parent(s): 99d5268

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -342,6 +342,9 @@ def run_tuning_task():
342
  liked_data = feedback_data.filter(lambda x: x['feedback'] == 1)
343
  print(f"Found {len(liked_data)} total liked responses for training.")
344
 
 
 
 
345
  if len(liked_data) < MIN_LIKES_FOR_TRAINING:
346
  TRAINING_STATUS = f"✅ Improvement complete! (Not enough new data to train, will try again later)."
347
  time.sleep(5)
@@ -452,6 +455,7 @@ def run_tuning_task():
452
  training_lock.release()
453
  print("--- PyTorch Fine-Tuning Task Finished ---")
454
 
 
455
  # -------------------------------
456
  # 7) UI Functions & Gradio Interface
457
  # -------------------------------
@@ -482,6 +486,8 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="blue")) a
482
  chatbot.like(log_feedback, inputs=[chatbot], outputs=None)
483
 
484
  demo.load(poll_status_updater, None, training_status_md)
 
 
485
  if __name__ == "__main__":
486
  print("Starting Gradio app. Tuning will be triggered by user feedback.")
487
  demo.launch(show_api=True)
 
342
  liked_data = feedback_data.filter(lambda x: x['feedback'] == 1)
343
  print(f"Found {len(liked_data)} total liked responses for training.")
344
 
345
+ # Add shuffle and sample 10,000 random examples
346
+ liked_data = liked_data.shuffle(seed=42).select(range(10000)) # Use first 10,000 samples
347
+
348
  if len(liked_data) < MIN_LIKES_FOR_TRAINING:
349
  TRAINING_STATUS = f"✅ Improvement complete! (Not enough new data to train, will try again later)."
350
  time.sleep(5)
 
455
  training_lock.release()
456
  print("--- PyTorch Fine-Tuning Task Finished ---")
457
 
458
+
459
  # -------------------------------
460
  # 7) UI Functions & Gradio Interface
461
  # -------------------------------
 
486
  chatbot.like(log_feedback, inputs=[chatbot], outputs=None)
487
 
488
  demo.load(poll_status_updater, None, training_status_md)
489
+
490
+
491
  if __name__ == "__main__":
492
  print("Starting Gradio app. Tuning will be triggered by user feedback.")
493
  demo.launch(show_api=True)