ITADN

CI fails with dev dependencies for gpt-oss models: RuntimeError: You set `ignore_mismatched_sizes` to `False`

#5621Openalbertvillanova 创建于 2026-04-22
A
albertvillanovacommented
CI fails with dev dependencies: https://github.com/huggingface/trl/actions/runs/24733098111/job/72352634220 > RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! ```python FAILED tests/test_dpo_trainer.py::TestDPOTrainer::test_train_moe_with_peft_config - RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! FAILED tests/test_dpo_trainer.py::TestDPOTrainer::test_train[trl-internal-testing/tiny-GptOssForCausalLM] - RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! FAILED tests/test_dpo_trainer.py::TestDPOTrainer::test_train_gpt_oss - RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! FAILED tests/test_sft_trainer.py::TestSFTTrainer::test_train[trl-internal-testing/tiny-GptOssForCausalLM] - RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! FAILED tests/test_sft_trainer.py::TestSFTTrainer::test_train_gpt_oss - RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! FAILED tests/test_utils.py::TestHashModule::test_hash_module_tiny_model_twice - RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! FAILED tests/test_utils.py::TestHashModule::test_hash_module_tiny_model_change_layer - RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! FAILED tests/test_utils.py::TestForwardMaskedLogits::test_llm[trl-internal-testing/tiny-GptOssForCausalLM] - RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! FAILED tests/test_utils.py::TestPatchChunkedLMHead::test_forward[1.0-trl-internal-testing/tiny-GptOssForCausalLM] - RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! FAILED tests/test_utils.py::TestPatchChunkedLMHead::test_forward[0.7-trl-internal-testing/tiny-GptOssForCausalLM] - RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! FAILED tests/test_sft_trainer.py::TestSFTTrainer::test_train_moe_with_peft_config - RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! FAILED tests/test_utils.py::TestPatchChunkedLMHead::test_backward[1.0-trl-internal-testing/tiny-GptOssForCausalLM] - RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! FAILED tests/test_utils.py::TestPatchChunkedLMHead::test_backward[0.7-trl-internal-testing/tiny-GptOssForCausalLM] - RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! FAILED tests/test_sft_trainer.py::TestSFTTrainer::test_train_completion_only_harmony - RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! = 14 failed ``` Stacktrace: ```python ________________ TestDPOTrainer.test_train_moe_with_peft_config ________________ [gw1] linux -- Python 3.12.13 /__w/trl/trl/.venv/bin/python3 self = <tests.test_dpo_trainer.TestDPOTrainer object at 0x7ff5779e3890> @require_peft def test_train_moe_with_peft_config(self): # Get the base model parameter names model_id = "trl-internal-testing/tiny-GptOssForCausalLM" > model = AutoModelForCausalLM.from_pretrained(model_id, dtype="float32") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tests/test_dpo_trainer.py:597: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .venv/lib/python3.12/site-packages/transformers/models/auto/auto_factory.py:394: in from_pretrained return model_class.from_pretrained( .venv/lib/python3.12/site-packages/transformers/modeling_utils.py:4211: in from_pretrained loading_info = cls._finalize_model_loading(model, load_config, loading_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .venv/lib/python3.12/site-packages/transformers/modeling_utils.py:4382: in _finalize_model_loading log_state_dict_report( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ model = GptOssForCausalLM( (model): GptOssModel( (embed_tokens): Embedding(200019, 8) (layers): ModuleList( (0...05) (rotary_emb): GptOssRotaryEmbedding() ) (lm_head): Linear(in_features=8, out_features=200019, bias=False) ) pretrained_model_name_or_path = 'trl-internal-testing/tiny-GptOssForCausalLM' ignore_mismatched_sizes = False loading_info = LoadStateDictInfo(missing_keys=set(), unexpected_keys=set(), mismatched_keys={('model.layers.0.mlp.experts.gate_up_pro....layers.0.mlp.experts.down_proj_bias', torch.Size([128, 8]), torch.Size([4, 8]))}, error_msgs=[], conversion_errors={}) logger = <Logger transformers.modeling_utils (WARNING)> def log_state_dict_report( model, pretrained_model_name_or_path: str, ignore_mismatched_sizes: bool, loading_info: LoadStateDictInfo, logger: logging.Logger | None = None, ): """ Log a readable report about state_dict loading issues. This version is terminal-size aware: for very small terminals it falls back to a compact Key | Status view so output doesn't wrap badly. """ if logger is None: logger = logging.getLogger(__name__) # Re-raise errors early if needed if loading_info.error_msgs: error_msg = "\n\t".join(loading_info.error_msgs) if "size mismatch" in error_msg: error_msg += ( "\n\tYou may consider adding `ignore_mismatched_sizes=True` to `from_pretrained(...)` if appropriate." ) raise RuntimeError(f"Error(s) in loading state_dict for {model.__class__.__name__}:\n\t{error_msg}") # Create the report table report = loading_info.create_loading_report() if report is None: return prelude = f"{PALETTE['bold']}{model.__class__.__name__} LOAD REPORT{PALETTE['reset']} from: {pretrained_model_name_or_path}\n" # Log the report as warning logger.warning(prelude + report) # Re-raise in those case, after the report if loading_info.conversion_errors: raise RuntimeError( "We encountered some issues during automatic conversion of the weights. For details look at the `CONVERSION` entries of " "the above report!" ) if not ignore_mismatched_sizes and loading_info.mismatched_keys: > raise RuntimeError( "You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report!" ) E RuntimeError: You set `ignore_mismatched_sizes` to `False`, thus raising an error. For details look at the above report! .venv/lib/python3.12/site-packages/transformers/utils/loading_report.py:278: RuntimeError ------------------------------ Captured log call ------------------------------- WARNING transformers.modeling_utils:loading_report.py:269 GptOssForCausalLM LOAD REPORT from: trl-internal-testing/tiny-GptOssForCausalLM Key | Status | --------------------------------------------------+----------+--------------------------------------------------------------------------------------------- model.layers.{0, 1}.mlp.experts.gate_up_proj | MISMATCH | Reinit due to size mismatch - ckpt: torch.Size([128, 8, 64]) vs model:torch.Size([4, 8, 64]) model.layers.{0, 1}.mlp.router.bias | MISMATCH | Reinit due to size mismatch - ckpt: torch.Size([128]) vs model:torch.Size([4]) model.layers.{0, 1}.mlp.experts.gate_up_proj_bias | MISMATCH | Reinit due to size mismatch - ckpt: torch.Size([128, 64]) vs model:torch.Size([4, 64]) model.layers.{0, 1}.mlp.experts.down_proj_bias | MISMATCH | Reinit due to size mismatch - ckpt: torch.Size([128, 8]) vs model:torch.Size([4, 8]) model.layers.{0, 1}.mlp.experts.down_proj | MISMATCH | Reinit due to size mismatch - ckpt: torch.Size([128, 32, 8]) vs model:torch.Size([4, 32, 8]) model.layers.{0, 1}.mlp.router.weight | MISMATCH | Reinit due to size mismatch - ckpt: torch.Size([128, 8]) vs model:torch.Size([4, 8]) Notes: - MISMATCH: ckpt weights were loaded, but they did not match the original empty weight shapes. ```
1 条评论