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

add config check for learning rate typing #699

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Quetzalcohuatl
Copy link
Contributor

common error is to set learning rate with e notation. For example 3e-4. Yaml parses it as a string

@pascal-pfeiffer
Copy link
Collaborator

pascal-pfeiffer commented May 9, 2024

Thank you for your PR @Quetzalcohuatl
After careful checks, I can assure you that the current implementation is working as intended and scientific notation is of course supported in .yaml configs.

Please make sure that you are using the yaml standard used in PyYAML and write scientific notation with a decimal point

learning_rate: 3.0e-4

or

learning_rate: 3.e-4

to be on the safe side, always write the base as a float and add a sign to the exponent (plus or minus).

@pascal-pfeiffer
Copy link
Collaborator

But your check can indeed make sense in order to catch a wrongfully formatted learning rate. In that case, please update the error message to reflect the correct usage.

@Quetzalcohuatl
Copy link
Contributor Author

But your check can indeed make sense in order to catch a wrongfully formatted learning rate. In that case, please update the error message to reflect the correct usage.

Yep, realized that after I made the post haha. Perhaps a config validator is an idea. There was another hyperparam (can't remember which one) where I passed 1.0 and it complained because it was a float and wanted an integer 1.

Copy link
Collaborator

@pascal-pfeiffer pascal-pfeiffer left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution, @Quetzalcohuatl !
Could you fix the style errors please.

./llm_studio/python_configs/cfg_checks.py:107:89: E501 line too long (105 > 88 characters)
./llm_studio/python_configs/cfg_checks.py:108:66: BLK100 Black would make changes.
./llm_studio/python_configs/cfg_checks.py:108:89: E501 line too long (111 > 88 characters)

Apart from that, the checks are only applied for UI use, where it shouldn't fail anyway, as these fields are type casted.
Two ways to solve probably:

  • apply these checks to CLI, too.
  • force type casting of these values

@Quetzalcohuatl
Copy link
Contributor Author

@pascal-pfeiffer Imo if you have the code for type-checking for UI, might as well lift-and-shift it to the CLI use-case. That would solve the error where for one of the hyperparams I typed "1.0" as a float but it wanted an integer as "1"

@pascal-pfeiffer
Copy link
Collaborator

Yes, that would be great. Though, in current form, the code will never get called.
The integration to CLI needs to be added

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