-
Notifications
You must be signed in to change notification settings - Fork 459
pass in model_name_or_path that is only augusta and it works
#1183
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -441,7 +441,12 @@ def make_internal_command(command: list[str], args: argparse.Namespace, whoami: | |||||||||
| is_open_instruct_training = any(cmd in command for cmd in OPEN_INSTRUCT_COMMANDS) | ||||||||||
| if is_open_instruct_training: | ||||||||||
| from open_instruct.dataset_transformation import get_commit_hash | ||||||||||
| from open_instruct.utils import download_from_hf, gs_folder_exists, upload_to_gs_bucket | ||||||||||
| from open_instruct.utils import ( | ||||||||||
| download_from_gs_bucket, | ||||||||||
| download_from_hf, | ||||||||||
| gs_folder_exists, | ||||||||||
| upload_to_gs_bucket, | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| # HACK: Cache dataset logic: | ||||||||||
| # Here we basically try to run the tokenization full_command locally before running it on beaker | ||||||||||
|
|
@@ -467,6 +472,31 @@ def make_internal_command(command: list[str], args: argparse.Namespace, whoami: | |||||||||
| continue | ||||||||||
|
|
||||||||||
| filtered_command = build_command_without_args(command[idx:], CACHE_EXCLUDED_ARGS) | ||||||||||
|
|
||||||||||
| # if model is only on gs, download tokenizer from gs for dataset preprocessing | ||||||||||
| try: | ||||||||||
| model_arg_idx = filtered_command.index("--model_name_or_path") | ||||||||||
| model_name_idx = model_arg_idx + 1 | ||||||||||
| model_name_or_path = filtered_command[model_name_idx].rstrip("/") | ||||||||||
|
|
||||||||||
| if model_name_or_path.startswith("gs://"): | ||||||||||
| model_name_hash = hashlib.md5(model_name_or_path.encode("utf-8")).hexdigest()[:8] | ||||||||||
| local_cache_folder = f"{args.auto_output_dir_path}/{whoami}/tokenizer_{model_name_hash}/" | ||||||||||
|
|
||||||||||
| if not os.path.exists(local_cache_folder): | ||||||||||
| download_from_gs_bucket( | ||||||||||
| [ | ||||||||||
| f"{model_name_or_path}/tokenizer.json", | ||||||||||
| f"{model_name_or_path}/tokenizer_config.json", | ||||||||||
| f"{model_name_or_path}/config.json", | ||||||||||
| ], | ||||||||||
| local_cache_folder, | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| filtered_command[model_name_idx] = local_cache_folder | ||||||||||
| except ValueError: | ||||||||||
| pass | ||||||||||
|
Comment on lines
+497
to
+498
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if
mnoukhov marked this conversation as resolved.
Show resolved
Hide resolved
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you rewrite this to make these changes:
|
||||||||||
|
|
||||||||||
| caching_command = "python " + " ".join(filtered_command) + " --cache_dataset_only" | ||||||||||
| console.log("📦📦📦 Running the caching command with `--cache_dataset_only`") | ||||||||||
| import subprocess | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1064,7 +1064,8 @@ def download_from_hf(model_name_or_path: str, revision: str) -> None: | |
| return output | ||
|
|
||
|
|
||
| def download_from_gs_bucket(src_path: str, dest_path: str) -> None: | ||
| def download_from_gs_bucket(src_paths: str | list[str], dest_path: str) -> None: | ||
| os.makedirs(dest_path, exist_ok=True) | ||
| cmd = [ | ||
| "gsutil", | ||
| "-o", | ||
|
|
@@ -1074,9 +1075,11 @@ def download_from_gs_bucket(src_path: str, dest_path: str) -> None: | |
| "-m", | ||
| "cp", | ||
| "-r", | ||
| src_path, | ||
| dest_path, | ||
| ] | ||
| if not isinstance(src_paths, list): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's change this to only take a list and force the callers to pass one in? |
||
| src_paths = [src_paths] | ||
| cmd.extend(src_paths) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add some tests here? Let's mock |
||
| cmd.append(dest_path) | ||
| print(f"Downloading from GS bucket with command: {cmd}") | ||
| live_subprocess_output(cmd) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list of files to download is hardcoded inside the
download_from_gs_bucketcall. To improve readability and maintainability, consider extracting this list into a named variable before the call. This makes it clearer what files are being downloaded. For example:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ehh, I think mine is fine as is