Skip to content

Fix gemma3 monkey patch tests - #735

Merged
lancerts merged 3 commits into
linkedin:mainfrom
shimizust:sshimizu/ci-fixes
May 28, 2025
Merged

lancerts merged 3 commits into
linkedin:mainfrom
shimizust:sshimizu/ci-fixes

Conversation

@shimizust

@shimizust shimizust commented May 28, 2025 •

Copy link
Copy Markdown
Collaborator

Summary

With transformers >= 4.52.0, there was some refactoring of gemma3 model code. Patching should still work for previous transformers version, but gemma3 tests won't pass for older transformers versions. Not sure we want to maintain that logic in the tests.

For reference:

  • Before (transformers <=4.51.3):
Gemma3ForConditionalGeneration
 - language_model (Gemma3ForCausalLM)
    - model (Gemma3TextModel)
       - layers/norm/etc.
  • After:
Gemma3ForConditionalGeneration
- model (Gemma3Model)
   - language_model (Gemma3TextModel)
      - layers/norm/etc.
- language_model (for backwards-compatibility, points to model.language_model (Gemma3TextModel))

Fixing part of #729

Testing Done

Gemma3 monkey patch tests pass

pytest test/transformers/test_monkey_patch.py::test_apply_liger_kernel_to_instance_for_gemma3_conditional_generation
pytest test/transformers/test_monkey_patch.py::test_apply_liger_kernel_to_instance_for_gemma3_text 
  • Hardware Type:
  • run make test to ensure correctness
  • run make checkstyle to ensure code style
  • run make test-convergence to ensure convergence

@shimizust
shimizust marked this pull request as ready for review May 28, 2025 21:44
@shimizust shimizust changed the title Sshimizu/ci fixes Fix gemma3 monkey patch tests May 28, 2025
@shimizust shimizust mentioned this pull request May 28, 2025
12 of 17 tasks
@shimizust
shimizust requested a review from lancerts May 28, 2025 22:03
@lancerts
lancerts merged commit e6fb45a into linkedin:main May 28, 2025
@Tcc0403 Tcc0403 mentioned this pull request Jun 25, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants