wenquanlu / HandRefiner

MIT License
701 stars 30 forks source link

SyntaxError: invalid syntax #19

Closed zhaojigang closed 5 months ago

zhaojigang commented 5 months ago

I followed install.md to install handlRefiner, but when i execute this command python handrefiner.py --input_img test/1.jpg --out_dir output --strength 0.55 --weights models/inpaint_depth_control.ckpt --prompt "a man facing the camera, making a hand gesture, indoor" --seed 1 , error occurred below.

ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities.data'

I find an answer from https://github.com/wenquanlu/HandRefiner/issues/5, but when I update pytorch_lightning version to 2.1.3. another error occurred.

Traceback (most recent call last):
  File "D:\ai\HandRefiner\handrefiner.py", line 39, in <module>
    from preprocessor.meshgraphormer import MeshGraphormerMediapipe
  File "D:\ai\HandRefiner\preprocessor\meshgraphormer.py", line 8, in <module>
    from MeshGraphormer.src.modeling.bert import BertConfig, Graphormer
  File "D:\ai\HandRefiner\MeshGraphormer\src\modeling\bert\__init__.py", line 3, in <module>
    from .modeling_bert import (BertConfig, BertModel,
  File "D:\ai\HandRefiner\MeshGraphormer\src\modeling\bert\modeling_bert.py", line 1
    ../../../transformers/pytorch_transformers/modeling_bert.py
    ^
SyntaxError: invalid syntax
FeatureIsNotABug commented 5 months ago

Why the issue is closed without an answer? I have the same problem and don't find a solution.

zhaojigang commented 5 months ago

Why the issue is closed without an answer? I have the same problem and don't find a solution.

hi, i think this is a path problem, my Python level is relatively low, so i just copied content of ../../../transformers/pytorch_transformers/modeling_bert.py to src\modeling\bert\modeling_bert.py to solve this problem. There are other files here that have some issue. and some path is wrong, you can solve them in pycharm.

if you can understand Chinese, i wrote an installation article https://www.jianshu.com/p/f5d421458746?v=1705760805683, you can find solution;