Skip to content

Add OpenRouter integration for engineer prompts#6

Open
tdi649852 wants to merge 3 commits into
VITA-Group:mainfrom
tdi649852:claude/add-openrouter-integration-01PBtnw6C8XhNrnxEAwf2tfK
Open

Add OpenRouter integration for engineer prompts#6
tdi649852 wants to merge 3 commits into
VITA-Group:mainfrom
tdi649852:claude/add-openrouter-integration-01PBtnw6C8XhNrnxEAwf2tfK

Conversation

@tdi649852

Copy link
Copy Markdown

This implementation allows using OpenRouter API to test multiple LLM models for engineer prompts instead of local models like vicuna-7b-v1.3.

Changes:

  • Add OpenRouterLLM class for API integration (utils/openrouter_llm.py)
  • Add OpenRouterBackwardInstructGenerator class (utils/dln.py)
  • Add command-line arguments: --use_openrouter, --openrouter_model, --openrouter_api_key
  • Update train_opt.py to support OpenRouter mode
  • Add comprehensive documentation (OPENROUTER_USAGE.md)
  • Update README.md with OpenRouter usage example
  • Update .gitignore to exclude openrouter_config.py

Benefits:

  • Test multiple LLM models (GPT-4, Claude, Llama, etc.) without local downloads
  • Reduce compute requirements for prompt generation
  • Flexible model selection via OpenRouter's unified API

Usage:
python train_opt.py --use_openrouter True \ --openrouter_model "meta-llama/llama-3-8b-instruct" \ --data sst2 --ape_mode iid_ibwd

This implementation allows using OpenRouter API to test multiple LLM
models for engineer prompts instead of local models like vicuna-7b-v1.3.

Changes:
- Add OpenRouterLLM class for API integration (utils/openrouter_llm.py)
- Add OpenRouterBackwardInstructGenerator class (utils/dln.py)
- Add command-line arguments: --use_openrouter, --openrouter_model, --openrouter_api_key
- Update train_opt.py to support OpenRouter mode
- Add comprehensive documentation (OPENROUTER_USAGE.md)
- Update README.md with OpenRouter usage example
- Update .gitignore to exclude openrouter_config.py

Benefits:
- Test multiple LLM models (GPT-4, Claude, Llama, etc.) without local downloads
- Reduce compute requirements for prompt generation
- Flexible model selection via OpenRouter's unified API

Usage:
  python train_opt.py --use_openrouter True \
    --openrouter_model "meta-llama/llama-3-8b-instruct" \
    --data sst2 --ape_mode iid_ibwd
This update allows running DP-OPT entirely via OpenRouter API without
downloading or loading any local LLM models.

Changes:
- Add OpenRouterEvaluator class (utils/evaluate.py) for API-based evaluation
- Update train_opt.py to skip all local model loading when --use_openrouter
- Use OpenRouter for both prompt generation AND evaluation
- Update documentation to reflect no-GPU, no-download operation

Benefits:
- Zero local model downloads - no storage/bandwidth requirements
- No GPU needed - runs entirely on CPU
- Perfect for resource-constrained environments (laptops, low-spec machines)
- Immediate start - no waiting for multi-GB model downloads

Usage:
  python train_opt.py --use_openrouter True \
    --openrouter_model "meta-llama/llama-3-8b-instruct" \
    --data sst2 --device cpu

Note: The --model argument is now optional when using OpenRouter
- Add warning message in OpenRouterEvaluator showing dataset sizes and estimates
- Update OPENROUTER_USAGE.md with evaluation limitations and solutions
- Recommend --holdout_ratio 0.01 or --skip_eval for faster/cheaper runs
- Document that evaluation makes one API call per sample (slow for large sets)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants