Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'type' object is not subscriptable #16

Closed
LiuxinYLX opened this issue May 31, 2024 · 2 comments
Closed

TypeError: 'type' object is not subscriptable #16

LiuxinYLX opened this issue May 31, 2024 · 2 comments

Comments

@LiuxinYLX
Copy link

Hi, thanks a lot for sharing your code! I have some problems, I am wondering if you could help me resolve it?

My objective:
Test if the detect.py works.

My command:
(venv) (base) liuxinyang@gm:~/Documents/Stage/deeptangle-main$ python3 examples/detect.py --model=weights/ --input=celegans_512.avi

My errors:
Unable to initialize backend 'cuda': module 'jaxlib.xla_extension' has no attribute 'GpuAllocatorConfig'
Unable to initialize backend 'rocm': module 'jaxlib.xla_extension' has no attribute 'GpuAllocatorConfig'
Unable to initialize backend 'tpu': INVALID_ARGUMENT: TpuPlatform is not available.
No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
Traceback (most recent call last):
File "examples/detect.py", line 56, in
app.run(main)
File "/home/liuxinyang/Documents/Stage/deeptangle-main/venv/lib/python3.8/site-packages/absl/app.py", line 308, in run
_run_main(main, args)
File "/home/liuxinyang/Documents/Stage/deeptangle-main/venv/lib/python3.8/site-packages/absl/app.py", line 254, in _run_main
sys.exit(main(argv))
File "examples/detect.py", line 22, in main
forward_fn, state = dt.load_model(FLAGS.model)
File "/home/liuxinyang/Documents/Stage/deeptangle-main/deeptangle/forward.py", line 72, in load_model
state = checkpoints.restore(origin_dir, broadcast=broadcast)
File "/home/liuxinyang/Documents/Stage/deeptangle-main/deeptangle/checkpoints.py", line 40, in restore
tree_struct = pickle.load(f)
File "/home/liuxinyang/Documents/Stage/deeptangle-main/venv/lib/python3.8/site-packages/optax/init.py", line 17, in
from optax import contrib
File "/home/liuxinyang/Documents/Stage/deeptangle-main/venv/lib/python3.8/site-packages/optax/contrib/init.py", line 21, in
from optax.contrib.dadapt_adamw import dadapt_adamw
File "/home/liuxinyang/Documents/Stage/deeptangle-main/venv/lib/python3.8/site-packages/optax/contrib/dadapt_adamw.py", line 45, in
betas: tuple[float, float] = (0.9, 0.999),
TypeError: 'type' object is not subscriptable

I am wondering if you know how to resolve this type of errors, please?

@LiuxinYLX
Copy link
Author

OK I settled it. In fact, we should change the code : tuple --> Tuple (if there is no tuple, import it).

@alonfnt
Copy link
Member

alonfnt commented Jun 1, 2024

Hi @LiuxinYLX, I'm glad you could fix it. It looks to me that the issue has to do with the version of optax. I've just merged #15, which solved some incompatibilities between libraries. Maybe you can try and see if that works better?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants