-
Notifications
You must be signed in to change notification settings - Fork 25
fixed bug where new runs would always be 50 percent, and added a headless execution option #20
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 2 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 | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -234,6 +234,8 @@ def main(): | |||||||||||||||||||||
| parser = argparse.ArgumentParser(description="Process SNR data for layers.") | ||||||||||||||||||||||
| parser.add_argument('--model-name', type=str, required=True, help='Model name or path to the model') | ||||||||||||||||||||||
| parser.add_argument('--top-percent', type=int, default=None, help='Top percentage of layers to select, overriding the default') | ||||||||||||||||||||||
| parser.add_argument('--all-layer-types', type=bool, default=False, help='Whether to include all layers in selection') | ||||||||||||||||||||||
| parser.add_argument('--batch-size', type=int, default=None, help='Batch size to use in SnR calculation') | ||||||||||||||||||||||
| args = parser.parse_args() | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Check for existing SNR results file | ||||||||||||||||||||||
|
|
@@ -244,12 +246,29 @@ def main(): | |||||||||||||||||||||
| print(f"Found existing SNR results file for {args.model_name}") | ||||||||||||||||||||||
| modifier = ModelModifier(top_percent=args.top_percent) | ||||||||||||||||||||||
| modifier.generate_unfrozen_params_yaml(snr_file_path, args.top_percent) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| weight_types = modifier.get_weight_types() | ||||||||||||||||||||||
| print(weight_types) | ||||||||||||||||||||||
|
Comment on lines
+249
to
+251
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. Critical: AttributeError when model is None. When an existing SNR file is found, Apply this diff to pass the model name when an existing SNR file exists: if os.path.exists(snr_file_path):
print(f"Found existing SNR results file for {args.model_name}")
- modifier = ModelModifier(top_percent=args.top_percent)
+ modifier = ModelModifier(model_name=args.model_name, top_percent=args.top_percent)
modifier.generate_unfrozen_params_yaml(snr_file_path, args.top_percent)
weight_types = modifier.get_weight_types()
print(weight_types)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| else: | ||||||||||||||||||||||
| print(f"No existing SNR results file found for {args.model_name}. Proceeding with SNR calculation.") | ||||||||||||||||||||||
| batch_size = input_dialog(title="Batch Size", text="Enter the batch size:").run() | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if args.batch_size is None: | ||||||||||||||||||||||
| batch_size = input_dialog(title="Batch Size", text="Enter the batch size:").run() | ||||||||||||||||||||||
| else: | ||||||||||||||||||||||
| batch_size = args.batch_size | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| batch_size = int(batch_size) if batch_size else 1 | ||||||||||||||||||||||
| modifier = ModelModifier(model_name=args.model_name, batch_size=batch_size) | ||||||||||||||||||||||
| selected_weight_types = modifier.interactive_select_weights() | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| modifier = ModelModifier(model_name=args.model_name, batch_size=batch_size, top_percent=args.top_percent) | ||||||||||||||||||||||
|
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. Critical: Explicitly passing When the user doesn't provide Apply this diff to only pass - modifier = ModelModifier(model_name=args.model_name, batch_size=batch_size, top_percent=args.top_percent)
+ modifier = ModelModifier(
+ model_name=args.model_name,
+ batch_size=batch_size,
+ top_percent=args.top_percent if args.top_percent is not None else 50
+ )Alternatively, if you adopt the refactor suggested in the previous comment (setting the argparse default to 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if args.all_layer_types: | ||||||||||||||||||||||
| weight_types = modifier.get_weight_types() | ||||||||||||||||||||||
| print(f"selecting all weight types: {weight_types}") | ||||||||||||||||||||||
| selected_weight_types = modifier.sort_weight_types(weight_types) | ||||||||||||||||||||||
| modifier.layer_types = selected_weight_types | ||||||||||||||||||||||
| else: | ||||||||||||||||||||||
| selected_weight_types = modifier.interactive_select_weights() | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if selected_weight_types: | ||||||||||||||||||||||
| modifier.assess_layers_snr(selected_weight_types) | ||||||||||||||||||||||
| modifier.save_snr_to_json() | ||||||||||||||||||||||
|
|
@@ -258,4 +277,4 @@ def main(): | |||||||||||||||||||||
| print("No weight types selected.") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if __name__ == "__main__": | ||||||||||||||||||||||
| main() | ||||||||||||||||||||||
| main() | ||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.