Call post_init() in HfMoondream for Transformers 5 compatibility

#33
by err805 - opened

This updates hf_moondream.py to call self.post_init() after constructing HfMoondream.

Why:

  • Newer Transformers v5 load paths expect PreTrainedModel.post_init() bookkeeping to have run.
  • Without this, loading moondream/moondream3-preview can fail with AttributeError: 'HfMoondream' object has no attribute 'all_tied_weights_keys'.

Validation:

  • Reproduced the v5 load failure before the change on a remote H100.
  • Verified successful GPU load + query after the change with transformers==5.3.0.
  • Verified successful GPU load + query after the change with transformers==4.51.1.

Issue first reported here: https://huggingface.co/moondream/moondream3-preview/discussions/30#69b24983059465dbb325146d

err805 changed pull request status to open
vikhyatk changed pull request status to merged

Sign up or log in to comment