Skip to content

Bug: TypeError while loading Gemma-1B model in the lab gdm_lab_1_3_compare_n_gram_models_and_transformer_language_models.ipynb #13

Description

@ThamizhiniyanCS

Steps to Reproduce:

  1. Open the "Compare N-Gram Models and Transformer Language Models" lab in Google Colab.
  2. Ensure a GPU runtime is selected (Runtime > Change runtime type > GPU). I was using the T4 GPU free version.
  3. Run all cells sequentially until the cell containing gemma_model = generation.load_gemma().

Error

Here is the cell output:

Loaded Africa Galore dataset with 232 paragraphs.

Loaded trigram model.

Loading Gemma-1B model...
WARNING:absl:Provided metadata contains unknown key custom. Adding it to custom_metadata.
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[/tmp/ipython-input-2823723241.py](https://github.com/google-deepmind/ai-foundations/issues/new#) in <cell line: 0>()
     12 
     13 print("Loading Gemma-1B model...")
---> 14 gemma_model = generation.load_gemma()
     15 print("Loaded Gemma-1B model.")

2 frames[/usr/local/lib/python3.12/dist-packages/ai_foundations/generation/loaders.py](https://github.com/google-deepmind/ai-foundations/issues/new#) in load_gemma(model_name)
     57     else:
     58       model = attention.AttentionWeightGemma3_1B()
---> 59     params = gm.ckpts.load_params(gm.ckpts.CheckpointPath.GEMMA3_1B_PT)
     60   elif model_name == "Gemma-4B":
     61     tokenizer = gm.text.Gemma3Tokenizer()

[/usr/local/lib/python3.12/dist-packages/gemma/gm/ckpts/_checkpoint.py](https://github.com/google-deepmind/ai-foundations/issues/new#) in load_params(path, params, donate, text_only, sharding, quantize)
    186   ckpt = ocp.StandardCheckpointer()
    187 
--> 188   metadata, path = _get_metadata_and_path(ckpt, path)
    189 
    190   metadata = _CheckpointTree.shape_dtype_struct_like(tree=metadata)

[/usr/local/lib/python3.12/dist-packages/gemma/gm/ckpts/_checkpoint.py](https://github.com/google-deepmind/ai-foundations/issues/new#) in _get_metadata_and_path(ckpt, path)
    431     else:
    432       raise
--> 433   metadata = dict(metadata)  # Normalize metadata
    434   return metadata, path
    435 

TypeError: 'StepMetadata' object is not iterable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions