Skip to content

Commit

Permalink
fix: cfg passed being none
Browse files Browse the repository at this point in the history
  • Loading branch information
NanoCode012 committed Jan 2, 2025
1 parent 0a83b88 commit 0f5d2bf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/axolotl/utils/trainer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module containing the Trainer class and related functions"""

import json
import math
import os
Expand Down Expand Up @@ -171,7 +172,9 @@ def add_length(sample):
return sample


def drop_long_seq(sample, sequence_len=2048, min_sequence_len=2):
def drop_long_seq(sample, sequence_len=2048, min_sequence_len=None):
min_sequence_len = min_sequence_len or 2

return (
len(sample["input_ids"]) <= sequence_len
and len(sample["input_ids"]) >= min_sequence_len
Expand All @@ -182,7 +185,7 @@ def drop_long_seq_in_dataset(dataset, cfg):
drop_long = partial(
drop_long_seq,
sequence_len=cfg.sequence_len,
min_sequence_len=cfg.min_sequence_len,
min_sequence_len=cfg.min_sample_len,
)

min_input_len = np.min(get_dataset_lengths(dataset))
Expand Down

0 comments on commit 0f5d2bf

Please sign in to comment.