Commit 01a66f1
authored
[Fix] Handle missing 'elementwise_affine' in RMSNorm extra_repr for patched models (#990)
## Summary
Fixes an AttributeError encountered in `LigerRMSNorm.extra_repr` when
models are patched `in-place` (e.g., using
`apply_liger_kernel_to_model`).
In my previous PR (#989 ), I added `elementwise_affine` to `extra_repr`
to improve layer visibility.
However, when layers are replaced via monkey patching, the
`LigerRMSNorm` constructor is typically skipped, leaving the instance
without the `elementwise_affine` attribute.
## Testing Done
I verified the fix locally. The issue is reproducible via
`test/transformers/test_monkey_patch.py`. After applying this fix,
`test/transformers/test_monkey_patch.py` passes successfully.
- Hardware Type: NVIDIA A100-SXM4-80GB
- [x] run `make test` to ensure correctness
- [x] run `make checkstyle` to ensure code style
- [x] run `make test-convergence` to ensure convergence1 parent 87d7057 commit 01a66f1
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
0 commit comments