google-deepmind / google-deepmind/gemma

typeguard 4.5.0 breaking changes

Open
#564 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
5.7k
Forks
1k
Avg merge
10h 33m
Merged PRs (30d)
2

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.