Add validation for minimum embed_dim in init_resampler

#57
by Haziq-exe - opened

Resampler is initialized with the hard-coded line num_heads = embed_dim // 128. When running with config.hidden_size < 128, it cryptically fails later on while giving an error message stating that num_heads=0 while embed_dim={embed_dimension value}

This change adds explicit validation with a helpful error message about the minimum embed_dim size so no more cryptic errors pop up and it is easier to debug.

Affects use cases:

  • Model compression/distillation research
  • Creating tiny test models for CI/CD
Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment