Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gemma/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def get_config_for_27b_v3(dtype: str) -> GemmaConfig:


def get_model_config(variant: str, dtype: str = 'bfloat16') -> GemmaConfig:
"""Gets the GemmaConfig for the diresired variant and dtype."""
"""Gets the GemmaConfig for the desired variant and dtype."""
# Gemma1 variants
if variant == '7b':
return get_config_for_7b(dtype)
Expand All @@ -336,5 +336,5 @@ def get_model_config(variant: str, dtype: str = 'bfloat16') -> GemmaConfig:
else:
raise ValueError(
f'Invalid variant {variant}. Supported variants are "1b", "2b", '
'"2b-v2", "4b",, "7b", "9b" "12b", "27b", and "27b_v3".'
'"2b-v2", "4b", "7b", "9b", "12b", "27b", and "27b_v3".'
)
2 changes: 1 addition & 1 deletion gemma/siglip_vision/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# https://developers.googleblog.com/en/gemma-explained-paligemma-architecture/
@dataclasses.dataclass
class SiglipVisionModelConfig:
"""Returns the model config for the vision model of Gemma 3 andPaliGemma."""
"""Returns the model config for the vision model of Gemma 3 and PaliGemma."""
# The number of transformer encoder blocks in the siglip encoder model.
num_hidden_layers: int = 27
# The dimension of the embedding.
Expand Down
6 changes: 4 additions & 2 deletions gemma/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

import sentencepiece

def _assert_file_exists(model_path: str):
assert os.path.isfile(model_path), model_path
def _assert_file_exists(model_path: Optional[str]):
if model_path is None:
raise ValueError("model_path cannot be None")
assert os.path.isfile(model_path), f"Model file not found: {model_path}"

_BEGIN_IMAGE_TOKEN = 255999
_END_IMAGE_TOKEN = 256000
Expand Down
2 changes: 1 addition & 1 deletion scripts/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
flags.DEFINE_string('prompt', 'What are large language models?', 'Input prompt for the model.')

# Define valid text only model variants
_VALID_MODEL_VARIANTS = ['2b', '2b-v2', '7b', '9b', '27b', '1b']
_VALID_MODEL_VARIANTS = ['1b', '2b', '2b-v2', '4b', '7b', '9b', '12b', '27b', '27b_v3']

# Define valid devices
_VALID_DEVICES = ['cpu', 'cuda']
Expand Down