Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ classifiers = [
requires-python = ">=3.10"
dependencies = [
"accelerate>=1.4.0",
"datasets>=3.0.0",
"datasets>=4.7.0", # Support Json type and on_mixed_types="use_json"
Comment thread
qgallouedec marked this conversation as resolved.
"packaging>20.0",
"transformers>=4.56.2",
]
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_harmony_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def main(test_size, push_to_hub, repo_id):
{"reasoning_effort": "high", "model_identity": "You are Tiny ChatGPT, a tiny language model."},
{"reasoning_effort": "low", "model_identity": "You are Tiny ChatGPT, a tiny language model."},
]
})
}, on_mixed_types="use_json")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here it's because we mix turns with and without "thinking" 👍

language_modeling_dataset = language_modeling_dataset.train_test_split(test_size=test_size, shuffle=False)
if push_to_hub:
language_modeling_dataset.push_to_hub(repo_id, config_name="language_modeling")
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate_toolcall_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def get_wind_conditions(city: str, unit: str) -> tuple[int, str]:
json.dumps([start_timer, create_reminder]),
json.dumps([get_weather_forecast, get_wind_conditions]),
]
})
}, on_mixed_types="use_json")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here I'm not sure if it's need, json.dumps converts to str

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I forgot to remove json.dumps. 😅 I'm pushing a new commit for this.

language_modeling_dataset = language_modeling_dataset.train_test_split(test_size=test_size, shuffle=False)
if push_to_hub:
language_modeling_dataset.push_to_hub(repo_id, config_name="language_modeling")
Expand Down Expand Up @@ -328,7 +328,7 @@ def get_wind_conditions(city: str, unit: str) -> tuple[int, str]:
json.dumps([create_reminder]),
json.dumps([get_wind_conditions]),
],
})
}, on_mixed_types="use_json")
preference_dataset = preference_dataset.train_test_split(test_size=test_size, shuffle=False)
if push_to_hub:
preference_dataset.push_to_hub(repo_id, config_name="preference")
Expand Down
6 changes: 0 additions & 6 deletions trl/trainer/dpo_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
get_config_model_id,
hash_module,
pad,
remove_none_values,
selective_log_softmax,
use_adapter,
)
Expand Down Expand Up @@ -863,11 +862,6 @@ def _prepare_dataset(
args: DPOConfig,
dataset_name: str,
) -> Dataset | IterableDataset:
# Tabular backends like Arrow/Parquet insert `None` for mismatched keys in nested structures. Clean them from
# sampled data.
if isinstance(dataset, Dataset): # IterableDataset does not support `with_transform`
dataset = dataset.with_transform(remove_none_values)

Comment thread
albertvillanova marked this conversation as resolved.
# Build the kwargs for the `map` function
map_kwargs = {}
if isinstance(dataset, Dataset): # IterableDataset does not support num_proc
Expand Down
7 changes: 1 addition & 6 deletions trl/trainer/reward_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
from ..models import get_act_offloading_ctx_manager
from .base_trainer import _BaseTrainer
from .reward_config import RewardConfig
from .utils import create_model_from_path, disable_dropout_in_model, get_config_model_id, pad, remove_none_values
from .utils import create_model_from_path, disable_dropout_in_model, get_config_model_id, pad


if is_peft_available():
Expand Down Expand Up @@ -541,11 +541,6 @@ def _prepare_dataset(
args: RewardConfig,
dataset_name: str,
) -> Dataset | IterableDataset:
# Tabular backends like Arrow/Parquet insert `None` for mismatched keys in nested structures. Clean them from
# sampled data.
if isinstance(dataset, Dataset): # IterableDataset does not support `with_transform`
dataset = dataset.with_transform(remove_none_values)

# If the dataset is already preprocessed (tokenized), skip the processing steps.
column_names = get_dataset_column_names(dataset)
is_processed = "chosen_ids" in column_names and "rejected_ids" in column_names
Expand Down
6 changes: 0 additions & 6 deletions trl/trainer/sft_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
flush_left,
get_config_model_id,
pad,
remove_none_values,
selective_log_softmax,
)

Expand Down Expand Up @@ -1054,11 +1053,6 @@ def _prepare_dataset(
formatting_func: Callable[[dict], str] | None,
dataset_name: str,
) -> Dataset | IterableDataset:
# Tabular backends like Arrow/Parquet insert `None` for mismatched keys in nested structures. Clean them from
Comment thread
cursor[bot] marked this conversation as resolved.
# sampled data.
if isinstance(dataset, Dataset): # IterableDataset does not support `with_transform`
dataset = dataset.with_transform(remove_none_values)

# If the dataset is already preprocessed (tokenized), skip the processing steps.
column_names = get_dataset_column_names(dataset)
is_processed = "input_ids" in column_names
Expand Down
Loading