Segfault loading LLaDA-8B-Instruct under transformers >= 5 (new core_model_loading path) β€” works with <5 pin

#20
by altf4gotme - opened

Symptom: AutoModel.from_pretrained("GSAI-ML/LLaDA-8B-Instruct", trust_remote_code=True, ...) hard-segfaults (no Python exception) during weight loading under transformers 5.x. Verified checkpoint integrity first (all six safetensors shards full-size, re-downloaded once to rule out corruption).

Environment: transformers 5.12.1, torch 2.11.0+cu128, Python 3.10, Windows 11, RTX 5060 Ti 16 GB (loading 4-bit via bitsandbytes 0.49.2, but the crash occurs with and without quantization).

Faulthandler stack at the crash (transformers' new weight-loading path):
Current thread (most recent call first):
...\torch\storage.py", line 471 in getitem
...\transformers\core_model_loading.py", line 989 in _materialize_copy
...\transformers\core_model_loading.py", line 1005 in _job
...\transformers\core_model_loading.py", line 797 in materialize_tensors
...\transformers\core_model_loading.py", line 830 in convert
...\transformers\core_model_loading.py", line 1466 in convert_and_load_state_dict_in_model
...\transformers\modeling_utils.py", line 4457 in _load_pretrained_model
...\transformers\modeling_utils.py", line 4327 in from_pretrained

Notes: standard architectures (e.g. gemma-2 family) load fine in the same environment under 5.12, so it appears specific to the interaction between LLaDA's trust_remote_code modeling files and the transformers β‰₯5 loader rewrite, not a general setup problem. Reproduces 3/3 attempts.
Workaround that fully resolves it: pin transformers>=4.46,<5 β€” same environment then loads and generates normally (verified end-to-end).
Might be worth a note in the model card until the remote code is updated for the v5 loader. Happy to provide more details or test a fix. (Context: we use LLaDA for a public research episode on text-diffusion emergence β€” write-up here β€” the pin is documented there for users.)

Sign up or log in to comment