pypa / flit

Simplified packaging of Python modules
https://flit.pypa.io/
BSD 3-Clause "New" or "Revised" License
2.14k stars 130 forks source link

Unable to run TransClawUNet #657

Closed Leslic18 closed 10 months ago

Leslic18 commented 10 months ago
Traceback (most recent call last):
  File "f:/TorchWork/transclawunet-main/TransClawUNet/trainer.py", line 18, in <module>
    from love import lovasz_softmax
  File "C:\Users\enc37\miniconda3\envs\pytorch-gpu\lib\site-packages\love\__init__.py", line 8, in <module>
    from .love import main, __version__
  File "C:\Users\enc37\miniconda3\envs\pytorch-gpu\lib\site-packages\love\love.py", line 34, in <module>
    from .flit import python_requires
  File "C:\Users\enc37\miniconda3\envs\pytorch-gpu\lib\site-packages\love\flit.py", line 6, in <module>
    from flit.inifile import _validate_config, _read_pkg_ini
ImportError: cannot import name '_validate_config' from 'flit.inifile' (C:\Users\enc37\miniconda3\envs\pytorch-gpu\lib\site-packages\flit\inifile.py)
takluyver commented 10 months ago

It looks like you've installed the love package, but from your traceback I think that's probably not what you want. love on PyPI is a tool for setting up Python packages, so it's unlikely to define the lovasz_softmax function. I don't know what package it is you're looking for.

Leslic18 commented 10 months ago

First thank you very much! I'm trying to replicate the Transclaw U-Net architecture, and the initial traceback is as follows: ################################################ Traceback (most recent call last): File "train.py", line 10, in from trainer import trainer_synapse File "/data2/wangq/TransClawUNet/trainer.py", line 17, in from love import lovasz_softmax File "/home/wangq/anaconda3/lib/python3.8/site-packages/love/init.py", line 8, in from .love import main, version File "/home/wangq/anaconda3/lib/python3.8/site-packages/love/love.py", line 34, in from .flit import python_requires File "/home/wangq/anaconda3/lib/python3.8/site-packages/love/flit.py", line 7, in from flit.inifile import _validate_config, _read_pkg_ini ModuleNotFoundError: No module named 'flit.inifile' ################################################# So I tried installing a lower version of flit to solve the problem, but I got an error like the one at the top——“ cannot import name '_validate_config' from 'flit.inifile' ”

takluyver commented 10 months ago

I don't think any version of flit will solve this issue, because the love package that you've installed is not a neural net thing. So if you fix the error from flit, you'll still be left with an error saying something like:

ImportError: cannot import name 'lovasz_softmax' from 'love' ...
pradyunsg commented 10 months ago

Based on https://paperswithcode.com/paper/transclaw-u-net-claw-u-net-with-transformers, https://github.com/yingernnn/transclawunet/ seems to be where the source code for the project is and there is an issue filed there to request for help with running the project with the same failure mode.

https://github.com/yingernnn/transclawunet/blob/6b6d045baf275df58de9688fee7c7aa4067e23aa/TransClawUNet/trainer.py#L17 is the relevant line there and it seems like the authors have missed a file or otherwise omitted something that contained an implementation/wrapper for https://arxiv.org/abs/1705.08790.

This isn't a bug in Flit, rather an issue with the code associated with the paper and the right thing to do is reach out to the authors to inform them about the lack of reproducibility IMO.

takluyver commented 10 months ago

Thanks @pradyunsg for that detective work! I'll close this issue now.