codelion commited on
Commit
4338fb1
·
verified ·
1 Parent(s): e51517c

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +64 -17
app.py CHANGED
@@ -12,16 +12,51 @@ import shutil
12
  import requests
13
  import glob
14
 
15
- # Free models from OpenRouter (as of 2025)
16
  FREE_MODELS = [
17
- "google/gemini-2.0-flash-001:free",
18
- "google/gemini-flash-1.5-8b:free",
19
- "meta-llama/llama-3.2-3b-instruct:free",
20
- "meta-llama/llama-3.2-1b-instruct:free",
21
- "microsoft/phi-3-mini-128k-instruct:free",
22
- "microsoft/phi-3-medium-128k-instruct:free",
23
- "qwen/qwen-2-7b-instruct:free",
24
- "mistralai/mistral-7b-instruct:free",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  ]
26
 
27
 
@@ -608,7 +643,7 @@ with gr.Blocks(title="OpenEvolve Prompt Optimizer", theme=gr.themes.Soft()) as d
608
  choices=FREE_MODELS,
609
  value=FREE_MODELS[0],
610
  label="Select Model",
611
- info="Free models available on OpenRouter"
612
  )
613
 
614
  dataset_name = gr.Textbox(
@@ -672,13 +707,25 @@ with gr.Blocks(title="OpenEvolve Prompt Optimizer", theme=gr.themes.Soft()) as d
672
  | openai/gsm8k | test | question | answer | Math Reasoning |
673
  | fancyzhx/ag_news | test | text | label | News Classification |
674
 
675
- ### Important Notes:
676
- - **API Key**: Must be set as `OPENAI_API_KEY` environment variable in Space secrets
677
- - **HF Token**: Optional `HF_TOKEN` environment variable for private datasets
678
- - **Dataset Name**: Use full name (org/dataset or dataset-name)
679
- - **Validation**: All inputs are validated before starting optimization
680
- - **Time**: Evolution takes 5-15 minutes (10 iterations)
681
- - **Samples**: 100 random samples per evaluation
 
 
 
 
 
 
 
 
 
 
 
 
682
 
683
  ### About OpenEvolve:
684
  OpenEvolve is an open-source evolutionary optimization framework. Learn more at:
 
12
  import requests
13
  import glob
14
 
15
+ # Free models from OpenRouter (as of 2025) - Comprehensive list
16
  FREE_MODELS = [
17
+ # Top-tier (heavily rate-limited)
18
+ "meta-llama/llama-3.1-405b-instruct:free", # 405B - Top-tier reasoning, multilingual
19
+ "nousresearch/hermes-3-llama-3.1-405b:free", # 405B - Creative/roleplay fine-tune
20
+
21
+ # High-capability (rate-limited)
22
+ "qwen/qwen2.5-72b-instruct:free", # 72B - Strong in coding/math/multilingual
23
+ "meta-llama/llama-3.1-70b-instruct:free", # 70B - Advanced reasoning
24
+ "mistralai/mixtral-8x7b-instruct:free", # 46.7B equiv - MoE efficient
25
+ "deepseek/deepseek-chat:free", # 67B - Conversational focus
26
+ "deepseek/deepseek-coder:free", # 33B - Coding specialist
27
+
28
+ # Mid-tier (good balance)
29
+ "qwen/qwen2.5-32b-instruct:free", # 32B - Detailed responses, math/coding
30
+ "google/gemma-2-27b-it:free", # 27B - Strong instruction-tuned
31
+ "qwen/qwen2.5-14b-instruct:free", # 14B - Mid-level tasks
32
+ "microsoft/phi-3-medium-128k-instruct:free", # 14B - Long context
33
+ "mistralai/pixtral-12b-2409:free", # 12B - Multimodal (text+image)
34
+
35
+ # Efficient (7-9B)
36
+ "qwen/qwen2.5-7b-instruct:free", # 7B - Balanced instruct
37
+ "meta-llama/llama-3-8b-instruct:free", # 8B - General-purpose
38
+ "meta-llama/llama-3.1-8b-instruct:free", # 8B - Improved multilingual
39
+ "google/gemma-2-9b-it:free", # 9B - Quick capable responses
40
+ "microsoft/phi-3-small-128k-instruct:free", # 7B - Extended context
41
+ "mistralai/mistral-7b-instruct:free", # 7B - Reliable baseline
42
+ "nousresearch/nous-hermes-2-mixtral-8x7b-dpo:free", # 46.7B equiv - Helpful aligned
43
+ "cognitivecomputations/dolphin-2.9-llama3-8b:free", # 8B - Uncensored
44
+ "huggingfaceh4/zephyr-7b-beta:free", # 7B - Basic assistance
45
+ "teknium/openhermes-2.5-mistral-7b:free", # 7B - Creative
46
+
47
+ # Lightweight (3-4B)
48
+ "openai/gpt-4o-mini:free", # ~8B equiv - Fast, capable mini
49
+ "undi95/replit-code-v1.5-3b-instruct:free", # 3B - Code-focused
50
+ "meta-llama/llama-3.2-3b-instruct:free", # 3B - Compact text gen
51
+ "qwen/qwen2.5-3b-instruct:free", # 3B - Quick responses
52
+ "sophosympatheia/nemotron-mini-4b-instruct:free", # 4B - Entry-level
53
+ "microsoft/phi-3-mini-128k-instruct:free", # 3.8B - Long context
54
+ "microsoft/phi-3-mini-4k-instruct:free", # 3.8B - Standard
55
+
56
+ # Ultra-light (0.5-1.5B)
57
+ "qwen/qwen2.5-1.5b-instruct:free", # 1.5B - Lightweight apps
58
+ "meta-llama/llama-3.2-1b-instruct:free", # 1B - Ultra-light multimodal
59
+ "qwen/qwen2.5-0.5b-instruct:free", # 0.5B - Minimalist
60
  ]
61
 
62
 
 
643
  choices=FREE_MODELS,
644
  value=FREE_MODELS[0],
645
  label="Select Model",
646
+ info="Choose from 30+ free models on OpenRouter (0.5B to 405B parameters)"
647
  )
648
 
649
  dataset_name = gr.Textbox(
 
707
  | openai/gsm8k | test | question | answer | Math Reasoning |
708
  | fancyzhx/ag_news | test | text | label | News Classification |
709
 
710
+ ### About This Demo Space:
711
+
712
+ **This is a demonstration space** showcasing OpenEvolve's prompt optimization capabilities.
713
+ The interface shows you how the system works, but **you'll need to set up your own instance to run optimizations**.
714
+
715
+ ### How to Run This Yourself:
716
+
717
+ 1. **Clone this Space**: Click "⋮" (three dots) at top-right → "Duplicate this Space"
718
+ 2. **Set Environment Variables** in your cloned Space's settings:
719
+ - `OPENAI_API_KEY`: Your OpenRouter API key (get free key at [openrouter.ai/keys](https://openrouter.ai/keys))
720
+ - `HF_TOKEN`: (Optional) HuggingFace token for private datasets
721
+ 3. **Configure Your Optimization**:
722
+ - Dataset: Use full name format (e.g., `stanfordnlp/imdb` or `openai/gsm8k`)
723
+ - Fields: Specify exact field names from the dataset schema
724
+ - Model: Choose from 30+ free models (larger models = better results but slower/rate-limited)
725
+ 4. **Run & Monitor**:
726
+ - All inputs are validated before starting
727
+ - Evolution takes 5-15 minutes (10 iterations, 100 samples per evaluation)
728
+ - Watch evolution progress visualization in real-time
729
 
730
  ### About OpenEvolve:
731
  OpenEvolve is an open-source evolutionary optimization framework. Learn more at: