google-research / jaxpruner

Apache License 2.0
206 stars 14 forks source link

TypeError: Subscripted generics cannot be used with class and instance checks #3

Closed jpilaul closed 1 year ago

jpilaul commented 1 year ago

I am using python3.9 and I am getting the following unit test error when installing:

Traceback (most recent call last):
  File "/home/jpilault/jaxpruner/jaxpruner/sparsity_distributions_test.py", line 63, in testUniformSparsityMapGeneratorWithCustomMap
    result = sparsity_distributions.uniform(
  File "/home/jpilault/jaxpruner/jaxpruner/sparsity_distributions.py", line 72, in uniform
    if isinstance(params, chex.Array):
  File "/usr/lib/python3.9/typing.py", line 703, in __instancecheck__
    return self.__subclasscheck__(type(obj))
  File "/usr/lib/python3.9/typing.py", line 706, in __subclasscheck__
    raise TypeError("Subscripted generics cannot be used with"
TypeError: Subscripted generics cannot be used with class and instance checks
evcu commented 1 year ago

Upgrading to python 3.11 should solve this (another commit fixing the another error for python 3.11 is on its way.) will update it here.

evcu commented 1 year ago

d92a781 fixes this. It should now work with latest python (3.11).