ZhouYuxuanYX / BlockGCN

This is the official implementation of our CVPR 2024 paper "BlockGCN: Redefine Topology Awareness for Skeleton-Based Action Recognition"
Apache License 2.0
58 stars 8 forks source link

各种包安装好之后,运行会报这个错 #10

Closed chenglong521 closed 2 months ago

chenglong521 commented 2 months ago

Traceback (most recent call last): File "/home/xxx/qcl/BlockGCN/main.py", line 796, in processor.start() File "/home/xxx/qcl/BlockGCN/main.py", line 726, in start self.train(epoch, save_model=save_model) File "/home/xxx/qcl/BlockGCN/main.py", line 503, in train output, z = self.model(data, F.one_hot(label, num_classes=self.model.module.num_class), joint) File "/home/xxx/zxl/anaconda3/envs/gcn/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'Model' object has no attribute 'module'运行会报这个错

chenglong521 commented 2 months ago

NW-UCLA跑的是这个数据集

ZhouYuxuanYX commented 2 months ago

这种是很简单的代码bug,希望大家以后遇到类似问题自己动手解决一下。你肯定用的是单卡,然后没有用nn.Parallel的话,就应该把model.module.num_class换成model.num_class。如果还有类似简单的代码问题请尽量自己去搜索学习和解决,谢谢。

chenglong521 commented 2 months ago

Traceback (most recent call last): File "/home/xxx/qcl/BlockGCN/main.py", line 796, in processor.start() File "/home/xxx/qcl/BlockGCN/main.py", line 726, in start self.train(epoch, save_model=save_model) File "/home/xxx/qcl/BlockGCN/main.py", line 503, in train output, z = self.model(data, F.one_hot(label, num_classes=self.model.num_class), joint) File "/home/xxx/zxl/anaconda3/envs/gcn/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(*input, kwargs) File "/home/xxx/qcl/BlockGCN/model/BlockGCN.py", line 400, in forward a = self.topo(a) File "/home/xxx/zxl/anaconda3/envs/gcn/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(*input, *kwargs) File "/home/xxx/qcl/BlockGCN/model/BlockGCN.py", line 342, in forward x = self.pl(x) File "/home/xxx/zxl/anaconda3/envs/gcn/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl return forward_call(input, kwargs) File "/home/xxx/zxl/anaconda3/envs/gcn/lib/python3.9/site-packages/torch_topological/nn/layers.py", line 39, in forward centres = torch.cat((centres, 2 * batch[..., -1].unsqueeze(-1)), 2) RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:5 and cpu! (when checking argument for argument tensors in method wrapper_cat)我之前就这样改过,但是改了之后会报这个错,你可以把环境信息requirements.txt放到项目里吗

ZhouYuxuanYX commented 2 months ago

For training on UCLA, please also refer to this issue