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

Unexpected keyword argument 'bf16' : Modified train.py to handle exceptions appropriately #20

Closed

Conversation

srivhash
Copy link
Contributor

Added a custom function that checks if the enlisted parameters within kwargs are valid.
If the type error is thrown, then the function ignores that specific parameter and checks for the other parameters.

All the parameters within kwargs are checked if they are valid.
# If the error is not due to an unexpected keyword argument, re-raise it
raise

def try_initialize_model_with_kwargs_2(model_config, custom_kwargs, num_labels=2, linear_probe=False):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only difference is device_map="auto"? you could just pass dict(**custom_kwargs, device_map="auto") and use a single function


# Remove the problematic keyword and retry
new_kwargs = {k: v for k, v in custom_kwargs.items() if k != problem_kwarg}
return try_initialize_model_with_kwargs(model_config, new_kwargs, num_labels, linear_probe)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bug i think? recursing into the wrong function

@srivhash
Copy link
Contributor Author

Added the requested changes

@WuTheFWasThat
Copy link
Contributor

using #22 instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants