Skip to content

refactor: rename num_embed to vocab_size for API consistency#576

Open
Sheshank-singh wants to merge 1 commit intogoogle-deepmind:mainfrom
Sheshank-singh:refactor/rename-num-embed-to-vocab-size
Open

refactor: rename num_embed to vocab_size for API consistency#576
Sheshank-singh wants to merge 1 commit intogoogle-deepmind:mainfrom
Sheshank-singh:refactor/rename-num-embed-to-vocab-size

Conversation

@Sheshank-singh
Copy link

This refactoring improves API consistency by renaming the num_embed field to vocab_size across the codebase. The name vocab_size better describes the field's purpose (the vocabulary size of the model's tokenizer) and aligns with common ML framework naming conventions.

Changes:

  • Renamed num_embed field in TransformerConfig classes to vocab_size
  • Updated all model configurations (Gemma2, Gemma3, Gemma3n, experimental)
  • Updated all usages in transformer implementations and tests
  • Updated research models (T5Gemma)
  • Updated documentation examples

Closes: TODO(epot) comments in _config.py and gemma3n/_config.py

Files Modified:

  • gemma/gm/nn/_config.py
  • gemma/gm/nn/_gemma.py
  • gemma/gm/nn/_transformer.py
  • gemma/gm/nn/_transformer_like.py
  • gemma/gm/nn/_experimental.py
  • gemma/gm/nn/gemma3n/_config.py
  • gemma/gm/nn/gemma3n/_transformer.py
  • gemma/gm/nn/gemma3n/_gemma3n.py
  • gemma/gm/testing/_dummy_model.py
  • gemma/research/t5gemma/config.py
  • gemma/research/t5gemma/modules.py
  • docs/research.md
  • All related test files

This refactoring improves API consistency by renaming the num_embed field
to vocab_size across the codebase. The name vocab_size better describes
the field's purpose (the vocabulary size of the model's tokenizer) and
aligns with common ML framework naming conventions.

Changes:
- Renamed num_embed field in TransformerConfig classes to vocab_size
- Updated all model configurations (Gemma2, Gemma3, Gemma3n, experimental)
- Updated all usages in transformer implementations and tests
- Updated research models (T5Gemma)
- Updated documentation examples

Closes: TODO(epot) comments in _config.py and gemma3n/_config.py

Files Modified:
- gemma/gm/nn/_config.py
- gemma/gm/nn/_gemma.py
- gemma/gm/nn/_transformer.py
- gemma/gm/nn/_transformer_like.py
- gemma/gm/nn/_experimental.py
- gemma/gm/nn/gemma3n/_config.py
- gemma/gm/nn/gemma3n/_transformer.py
- gemma/gm/nn/gemma3n/_gemma3n.py
- gemma/gm/testing/_dummy_model.py
- gemma/research/t5gemma/config.py
- gemma/research/t5gemma/modules.py
- docs/research.md
- All related test files
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.

1 participant