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

Use the pretrained generation config if it exists for HF models #1440

Merged
merged 3 commits into from
Aug 9, 2024

Conversation

irenedea
Copy link
Contributor

@irenedea irenedea commented Aug 9, 2024

If you instantiate a model with from_config, the generation config is obtained via GenerationConfig.from_model_config(model_config). This causes models that are not pretrained to not use the correct generation config.

To address this, we always set the generation config to be the generation config obtained from pretrained_model_name_or_path if the generation config exists.

@irenedea irenedea requested a review from a team as a code owner August 9, 2024 04:21
@irenedea irenedea requested review from dakinggg and snarayan21 August 9, 2024 04:21
Copy link
Contributor

@snarayan21 snarayan21 left a comment

Choose a reason for hiding this comment

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

looks great! unit test should cover functionality so lgtm!

Copy link
Contributor

@snarayan21 snarayan21 left a comment

Choose a reason for hiding this comment

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

failing tests

tests/models/hf/test_hf_config.py Outdated Show resolved Hide resolved
@irenedea irenedea enabled auto-merge (squash) August 9, 2024 17:12
@irenedea irenedea merged commit 9cdfd6d into mosaicml:main Aug 9, 2024
9 checks passed
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.

2 participants