diff --git a/flax/nnx/filterlib.py b/flax/nnx/filterlib.py index 824eb4315..e96d5ebc6 100644 --- a/flax/nnx/filterlib.py +++ b/flax/nnx/filterlib.py @@ -52,7 +52,7 @@ def to_predicate(filter: Filter) -> Predicate: elif isinstance(filter, (list, tuple)): return Any(*filter) else: - raise TypeError(f'Invalid collection filter: {filter:!r}. ') + raise TypeError(f'Invalid collection filter: {filter!r}. ') def filters_to_predicates( filters: tp.Sequence[Filter], diff --git a/flax/nnx/variablelib.py b/flax/nnx/variablelib.py index 8268c0651..8fa8f39a8 100644 --- a/flax/nnx/variablelib.py +++ b/flax/nnx/variablelib.py @@ -2292,8 +2292,8 @@ def variable_name_from_type( name = typ.__name__ if name in VariableTypeCache: raise ValueError( - 'Name {name} is already registered in the registry as {VariableTypeCache[name]}. ' - 'It cannot be linked with this type {typ}.' + f'Name {name} is already registered in the registry as {VariableTypeCache[name]}. ' + f'It cannot be linked with this type {typ}.' ) register_variable_name(name, typ) return name