Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: generated_data as list #398

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all 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
12 changes: 3 additions & 9 deletions src/instructlab/sdg/generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def generate_data(
"Synthesizing new instructions. If you aren't satisfied with the generated instructions, interrupt training (Ctrl-C) and try adjusting your YAML files. Adding more examples may help."
)

generated_data = None
generated_data = []
empty_sdg_leaf_nodes = []
for leaf_node in leaf_nodes.values():
is_knowledge = False
Expand Down Expand Up @@ -444,11 +444,8 @@ def generate_data(
empty_sdg_leaf_nodes.append(leaf_node_path)
logger.warning("Empty dataset for qna node: %s", leaf_node_path)
continue
generated_data = (
[new_generated_data]
if generated_data is None
else generated_data + [new_generated_data]
)
generated_data.append(new_generated_data)
bbrowning marked this conversation as resolved.
Show resolved Hide resolved

logger.info("Generated %d samples", len(generated_data))
logger.debug("Generated data: %s", generated_data)

Expand All @@ -469,9 +466,6 @@ def generate_data(
use_legacy_pretraining_format,
)

if generated_data is None:
generated_data = []

_gen_train_data(
generated_data,
os.path.join(output_dir, output_file_train),
Expand Down
Loading