-
Notifications
You must be signed in to change notification settings - Fork 90
Fix for when draft model hidden dimension is different from target model hidden dimension #183
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 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -259,8 +259,14 @@ def main(): | |||||||||||||||||
.cuda() | ||||||||||||||||||
.to(torch.bfloat16) | ||||||||||||||||||
) | ||||||||||||||||||
draft_model.load_embedding(args.target_model_path, embedding_key=args.embedding_key) | ||||||||||||||||||
draft_model.freeze_embedding() | ||||||||||||||||||
if ( | ||||||||||||||||||
not hasattr(draft_model_config, "target_hidden_size") | ||||||||||||||||||
or draft_model_config.target_hidden_size == draft_model_config.hidden_size | ||||||||||||||||||
): | ||||||||||||||||||
Comment on lines
+262
to
+265
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. This condition can be made more concise and idiomatic by using On a related note, this entire conditional block is duplicated from
Suggested change
|
||||||||||||||||||
draft_model.load_embedding( | ||||||||||||||||||
args.target_model_path, embedding_key=args.embedding_key | ||||||||||||||||||
) | ||||||||||||||||||
draft_model.freeze_embedding() | ||||||||||||||||||
print_with_rank("Initialized draft model") | ||||||||||||||||||
|
||||||||||||||||||
# build dataloaders | ||||||||||||||||||
|
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.
This condition can be made more concise and idiomatic by using
getattr
with a default value. This avoids explicitly checking for the attribute's existence before accessing it.On a related note, this entire conditional block is duplicated in
scripts/train_eagle3_online.py
. Consider refactoring the model setup logic into a shared utility function to improve maintainability and avoid future inconsistencies.