huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
134.76k stars 26.95k forks source link

No warningmessage when load models with a gamma or beta parameter #33190

Closed zly-idleness closed 1 month ago

zly-idleness commented 2 months ago

System Info

Who can help?

No response

Information

Tasks

Reproduction

Just like #29554 previous commit just info at load_state and no warning message if you load model just in

4061 def _load_pretrained_model(
            ...
    ):

there will be no warning message at all !!

Expected behavior

(vqa-audio) (base) jeeves@notebook-5064-cadence:~/ChatTTS/rhapsodyaudio$ python tmp_save_pretrain.py 
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Loading checkpoint shards: 100%|██████████████████████████████████████████████████████████████████████████████| 8/8 [00:16<00:00,  2.02s/it]
Some weights of Qwen2AudioForConditionalChatTTS were not initialized from the model checkpoint at /mnt/data/user/tc_agi/luoyuanZ/ChatTTS_default and are newly initialized: 

['tts.dvae.decoder.decoder_block.0.gamma', 'tts.dvae.decoder.decoder_block.1.gamma', 'tts.dvae.decoder.decoder_block.10.gamma', 'tts.dvae.decoder.decoder_block.11.gamma', 'tts.dvae.decoder.decoder_block.2.gamma', 'tts.dvae.decoder.decoder_block.3.gamma', 'tts.dvae.decoder.decoder_block.4.gamma', 'tts.dvae.decoder.decoder_block.5.gamma', 'tts.dvae.decoder.decoder_block.6.gamma', 'tts.dvae.decoder.decoder_block.7.gamma', 'tts.dvae.decoder.decoder_block.8.gamma', 'tts.dvae.decoder.decoder_block.9.gamma', 'tts.dvae.encoder.decoder_block.0.gamma', 'tts.dvae.encoder.decoder_block.1.gamma', 'tts.dvae.encoder.decoder_block.10.gamma', 'tts.dvae.encoder.decoder_block.11.gamma', 'tts.dvae.encoder.decoder_block.2.gamma', 'tts.dvae.encoder.decoder_block.3.gamma', 'tts.dvae.encoder.decoder_block.4.gamma', 'tts.dvae.encoder.decoder_block.5.gamma', 'tts.dvae.encoder.decoder_block.6.gamma', 'tts.dvae.encoder.decoder_block.7.gamma', 'tts.dvae.encoder.decoder_block.8.gamma', 'tts.dvae.encoder.decoder_block.9.gamma']
LysandreJik commented 2 months ago

cc @amyeroberts and @muellerz as you have been working on a PR for that

amyeroberts commented 2 months ago

Hi @zly-idleness, thanks for raising!

We merged in #32656 which should address this. It's currently just on main and will be part of the next release. If you want to try the development branch with this feature, you can install from source: pip install git+https://github.com/huggingface/transformers

zly-idleness commented 2 months ago

Hi @zly-idleness, thanks for raising!

We merged in #32656 which should address this. It's currently just on main and will be part of the next release. If you want to try the development branch with this feature, you can install from source: pip install git+https://github.com/huggingface/transformers

I have reviewed the recent commit, but it failed to solve the issue I'm facing. There have been prior commits addressing this bug, and my current version of the code already includes mechanisms to detect such behavior. However, the expected warning messages from the logger are not being outputted. To address this, I've submitted a pull request that enhances the _load_pretrained_model() function with additional warnings and informational messages. With these changes, the warning messages are now correctly displayed.

amyeroberts commented 2 months ago

Ah, OK, I see - thanks for explaining and opening up a PR to address!

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.