athn-nik / teach

Official PyTorch implementation of the paper "TEACH: Temporal Action Compositions for 3D Humans"
https://teach.is.tue.mpg.de
Other
383 stars 40 forks source link

'type' object is not subscriptable #22

Closed wang-zm18 closed 1 year ago

wang-zm18 commented 1 year ago

Hello, When I tried to run the interact_teach.py, it just occrus this problem: ImportError: Encountered error: 'type' object is not subscriptable when loading module 'teach.model.teach.TEACH'

The command I used is : python ./teach/interact_teach.py folder=./teach output=./teach/experiments texts='[walk, sit down, wave hands, drink water, stand up]' durs='[5,5,5,5,5]'

Thank you in advance!

wang-zm18 commented 1 year ago

BTW, I have placed the SMPLH_MALE.pkl in the right path.

athn-nik commented 1 year ago

It does not have to do with SMPLh model but some imports, can you try giving the full path instead of relative? and also post here the full error log to help you more. does ./teach contains the checkpoints and hydra folder?

wang-zm18 commented 1 year ago

the path to run this command: /share/allen/teach the command is python./interact_teach.py folder=/share/allen/teach output=/share/allen/teach/experiments texts='[walk, sit down, wave hands, drink water, stand up]' durs='[5,5,5,5,5]'

The log is

Global seed set to 1234

[17/11/22 10:24:31][main][INFO] - Loading model Error executing job with overrides: ['folder=/share/allen/teach', 'output=/share/allen/teach/experiments', 'texts=[walk, sit down, wave hands, drink water, stand up]', 'durs=[5,5,5,5,5]'] Traceback (most recent call last): File "/share/allen/teach/teach-env/lib/python3.8/site-packages/hydra/_internal/utils.py", line 585, in _locate import_module(mod) File "/home/admin/miniconda3/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 843, in exec_module File "", line 219, in _call_with_frames_removed File "/share/allen/teach/model/teach.py", line 29, in from teach.model.metrics import ComputeMetricsTeach File "/share/allen/teach/model/metrics/init.py", line 1, in from .compute import ComputeMetrics File "/share/allen/teach/model/metrics/compute.py", line 24, in from teach.transforms.joints2jfeats import Rifke File "/share/allen/teach/transforms/init.py", line 2, in from .smpl import SMPLTransform File "/share/allen/teach/transforms/smpl.py", line 25, in from .joints2jfeats import Joints2Jfeats File "/share/allen/teach/transforms/joints2jfeats/init.py", line 2, in from .rifke import Rifke File "/share/allen/teach/transforms/joints2jfeats/rifke.py", line 27, in class Rifke(Joints2Jfeats): File "/share/allen/teach/transforms/joints2jfeats/rifke.py", line 139, in Rifke def extract(self, features: Tensor) -> tuple[Tensor]: TypeError: 'type' object is not subscriptable

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "./interact_teach.py", line 35, in _interact return interact(cfg) File "./interact_teach.py", line 57, in interact model = instantiate(cfg.model, File "/share/allen/teach/teach-env/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 180, in instantiate return instantiate_node(config, *args, recursive=recursive, convert=convert) File "/share/allen/teach/teach-env/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 240, in instantiate_node target = _resolve_target(node.get(_Keys.TARGET)) File "/share/allen/teach/teach-env/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 104, in _resolve_target return _locate(target) File "/share/allen/teach/teach-env/lib/python3.8/site-packages/hydra/_internal/utils.py", line 587, in _locate raise ImportError( ImportError: Encountered error: 'type' object is not subscriptable when loading module 'teach.model.teach.TEACH'

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

wang-zm18 commented 1 year ago

./teach contains the checkpoints and hydra folder indeed. image

wang-zm18 commented 1 year ago

When I just tried teach.model.teach.TEACH in python, it directly occurs TypeError: 'type' object is not subscriptable

athn-nik commented 1 year ago

Hmm, the paths the you give in the command line does not match what I am seeing in the screenshot, I guess this is not so relevant with issue. In the screenshot that I see I do not see where the teach folder is, I wonder why you have put everything in the same folder and why not in the top directory. I would suggest doing a fresh clean installation. Download the checkpoint again and put them outside the repository and give one more try. Nobody had the problem before and it is very difficult to debug it with that setup.

athn-nik commented 1 year ago

Hey @wang-zm18 , have you tried my suggestion?

wang-zm18 commented 1 year ago

Thank you, I have solved this problem according to your advice!