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

set_initialized_submodules too slow when loading big model like DeepSeekV3 #35635

Closed
4 tasks
hongchuan666 opened this issue Jan 12, 2025 · 2 comments
Closed
4 tasks
Labels

Comments

@hongchuan666
Copy link

System Info

transformers==4.44.0

Who can help?

No response

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

Load a model that has 40000+ nn.Modules (etc. DeepSeekV3),then you will find it cost too much time on set_initialized_submodules.

Expected behavior

This function is O(N^2) and should be optimized.

@Rocketknight1
Copy link
Member

Yep, it's definitely O(n^2). Let me see if I can whip something up!

@Rocketknight1
Copy link
Member

Fixed by #35493

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

Successfully merging a pull request may close this issue.

2 participants