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

fix args.mock_data bug caused by func get_blend_and_blend_per_split #1306

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
55 changes: 28 additions & 27 deletions megatron/training/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,36 +337,37 @@ def get_blend_and_blend_per_split(args):

blend = None
blend_per_split = None
if use_data_path:
if args.data_args_path is not None:
assert args.data_path is None
with open(args.data_args_path, 'r') as f:
blend = get_blend_from_list(f.read().split())
if not args.mock_data:
if use_data_path:
if args.data_args_path is not None:
assert args.data_path is None
with open(args.data_args_path, 'r') as f:
blend = get_blend_from_list(f.read().split())
else:
assert args.data_path is not None
blend = get_blend_from_list(args.data_path)
else:
assert args.data_path is not None
blend = get_blend_from_list(args.data_path)
else:
assert use_per_split_data_path
if args.per_split_data_args_path is not None:
with open(args.per_split_data_args_path, 'r') as f:
per_split_data_args = json.load(f)
# Each element in blend_per_split should be a list of files (and optional
# weights), so split string if needed.
for split in ["train", "valid", "test"]:
if isinstance(per_split_data_args[split], str):
per_split_data_args[split] = per_split_data_args[split].split()

assert use_per_split_data_path
if args.per_split_data_args_path is not None:
with open(args.per_split_data_args_path, 'r') as f:
per_split_data_args = json.load(f)
# Each element in blend_per_split should be a list of files (and optional
# weights), so split string if needed.
for split in ["train", "valid", "test"]:
if isinstance(per_split_data_args[split], str):
per_split_data_args[split] = per_split_data_args[split].split()

blend_per_split = [
get_blend_from_list(per_split_data_args["train"]),
get_blend_from_list(per_split_data_args["valid"]),
get_blend_from_list(per_split_data_args["test"])
]
else:
blend_per_split = [
get_blend_from_list(per_split_data_args["train"]),
get_blend_from_list(per_split_data_args["valid"]),
get_blend_from_list(per_split_data_args["test"])
get_blend_from_list(args.train_data_path),
get_blend_from_list(args.valid_data_path),
get_blend_from_list(args.test_data_path)
]
else:
blend_per_split = [
get_blend_from_list(args.train_data_path),
get_blend_from_list(args.valid_data_path),
get_blend_from_list(args.test_data_path)
]

return blend, blend_per_split

Expand Down