-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add E2B code interpreter reward function (#364)
* Add stuff * Make it kind of work * Add more stuff * Add fix for parse * Fix * Refactor * Clean up * Fix config * Fix sys * Add SFT config * Use min rate * Fix eval * Add base model * Add s1k * Disable eval * Fix * Add import checker * Fix importer * Fix * Tune config * Tune * Fix * Fix save * Tuen beta * Remove configs * Fix vLLM * Fix * Add note * Add doc * doc * Fix * Tune lr * Add command
- Loading branch information
Showing
7 changed files
with
211 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Model arguments | ||
model_name_or_path: Qwen/Qwen2.5-1.5B-Instruct | ||
model_revision: main | ||
torch_dtype: bfloat16 | ||
attn_implementation: flash_attention_2 | ||
|
||
# Data training arguments | ||
dataset_name: open-r1/verifiable-coding-problems-python-10k | ||
dataset_configs: | ||
- default | ||
system_prompt: "You are a helpful AI Assistant that provides well-reasoned and detailed responses. You first think about the reasoning process as an internal monologue and then provide the user with the answer. Respond in the following format: <think>\n...\n</think>\n<answer>\n...\n</answer>" | ||
|
||
# GRPO trainer config | ||
beta: 0.01 | ||
bf16: true | ||
use_vllm: true | ||
vllm_device: auto | ||
vllm_gpu_memory_utilization: 0.9 | ||
do_eval: false | ||
gradient_accumulation_steps: 4 | ||
gradient_checkpointing: true | ||
gradient_checkpointing_kwargs: | ||
use_reentrant: false | ||
hub_model_id: Qwen2.5-1.5B-Open-R1-Code-GRPO | ||
hub_strategy: every_save | ||
learning_rate: 5.0e-06 | ||
log_completions: true | ||
log_level: info | ||
logging_first_step: true | ||
logging_steps: 1 | ||
logging_strategy: steps | ||
lr_scheduler_type: cosine_with_min_lr | ||
lr_scheduler_kwargs: | ||
min_lr_rate: 0.1 | ||
max_prompt_length: 1024 | ||
max_completion_length: 2048 | ||
max_steps: 500 | ||
num_generations: 14 | ||
num_train_epochs: 1 | ||
output_dir: data/Qwen2.5-1.5B-Open-R1-Code-GRPO | ||
overwrite_output_dir: true | ||
per_device_train_batch_size: 16 | ||
push_to_hub: true | ||
report_to: | ||
- wandb | ||
reward_funcs: | ||
- code | ||
- format | ||
reward_weights: | ||
- 1.0 | ||
- 0.1 | ||
save_strategy: "steps" | ||
save_steps: 50 | ||
save_total_limit: 1 | ||
seed: 42 | ||
temperature: 1.0 | ||
warmup_ratio: 0.03 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from .import_utils import is_e2b_available | ||
from .model_utils import get_tokenizer | ||
|
||
|
||
__all__ = ["get_tokenizer"] | ||
__all__ = ["get_tokenizer", "is_e2b_available"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2025 The HuggingFace Team. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from transformers.utils.import_utils import _is_package_available | ||
|
||
|
||
# Use same as transformers.utils.import_utils | ||
_e2b_available = _is_package_available("e2b") | ||
|
||
|
||
def is_e2b_available() -> bool: | ||
return _e2b_available |