GFNOrg / torchgfn

GFlowNet library
https://torchgfn.readthedocs.io/en/latest/
Other
209 stars 26 forks source link

Example scripts typing fails with `X is not a generic class` #137

Closed josephdviviano closed 11 months ago

josephdviviano commented 11 months ago
$ python train_hypergrid.py 
Traceback (most recent call last):
  File "/home/jdv/code/torchgfn/tutorials/examples/train_hypergrid.py", line 21, in <module>
    from gfn.gflownet import (
  File "/home/jdv/code/torchgfn/src/gfn/gflownet/__init__.py", line 1, in <module>
    from .base import GFlowNet, PFBasedGFlowNet, TrajectoryBasedGFlowNet
  File "/home/jdv/code/torchgfn/src/gfn/gflownet/base.py", line 78, in <module>
    class TrajectoryBasedGFlowNet(PFBasedGFlowNet[Trajectories]):
  File "/home/jdv/miniconda3/envs/torchgfn/lib/python3.10/typing.py", line 312, in inner
    return func(*args, **kwds)
  File "/home/jdv/miniconda3/envs/torchgfn/lib/python3.10/typing.py", line 1345, in __class_getitem__
    _check_generic(cls, params, len(cls.__parameters__))
  File "/home/jdv/.local/lib/python3.10/site-packages/typing_extensions.py", line 152, in _check_generic
    raise TypeError(f"{cls} is not a generic class")
TypeError: <class 'gfn.gflownet.base.PFBasedGFlowNet

I'm not sure when this was introduced.

josephdviviano commented 11 months ago

@marpaia perhaps we will be able to collaborate on this one

josephdviviano commented 11 months ago

This is fixed in https://github.com/saleml/torchgfn/pull/139

saleml commented 11 months ago

Good catch. #139 is ready to be merged!