Skip to content

typeguard 4.5.0 breaking changes #564

@nmilosev

Description

@nmilosev

When running the Tool calling example on Colab the following error is shown:

---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

[/usr/local/lib/python3.12/dist-packages/kauldron/typing/type_check.py](https://localhost:8080/#) in _check_argument_types(func, args, kwargs, bound_args, annotations)
    199       memo = typeguard.TypeCheckMemo(func.__globals__, local_ns)
--> 200       typeguard._functions.check_argument_types(  # pylint: disable=protected-access
    201           func.__name__, annotated_arguments, memo=memo

TypeError: check_argument_types() got an unexpected keyword argument 'memo'


The above exception was the direct cause of the following exception:

TypeCheckError                            Traceback (most recent call last)

7 frames

    [... skipping hidden 13 frame]

    [... skipping hidden 1 frame]

[/usr/local/lib/python3.12/dist-packages/kauldron/typing/type_check.py](https://localhost:8080/#) in _check_argument_types(func, args, kwargs, bound_args, annotations)
    204     raise
    205   except Exception as e:
--> 206     raise TypeCheckError(
    207         message=f"Unknown error '{str(e)}' occurred during type-checking of "
    208                 f"function {func.__qualname__}.",

TypeCheckError: Unknown error 'check_argument_types() got an unexpected keyword argument 'memo'' occurred during type-checking of function make_causal_bidirectional_attention_mask.

Function: make_causal_bidirectional_attention_mask in /usr/local/lib/python3.12/dist-packages/gemma/gm/utils/_attention_mask.py:23

Inputs:
  causal_mask: Bool['B L'] = bool_[1 512]
  bidirectional_mask: Bool['B L'] = None

Inferred Dims:
 {}

The issue is reproducible on Google Colab, TPU machines on GCE, and local machine.

The issue is caused by 4.5.0 release of typeguard https://github.com/agronholm/typeguard/releases/tag/4.5.0 and it can be resolved with freezing the typeguard version to 4.4.1.

pip install --upgrade "typeguard==4.4.1"

I am not sure whether this issue belongs here or in https://github.com/google-research/kauldron I will open a cloned issue there.

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