disco-diffusion icon indicating copy to clipboard operation
disco-diffusion copied to clipboard

ImportError: cannot import name 'InferenceHelper' from 'infer' (/home/ubuntu/.local/lib/python3.8/site-packages/infer/__init__.py)

Open YIN-Renlong opened this issue 2 years ago • 7 comments

Hello, I attempted to install it (Disco_Diffusion_v5_4_[Now_with_Warp].ipynb) on Ubuntu 20.04 LTS, with Jupyter Lab, however received the following issues. Is there an equivalent solution? thanks

disco_xform_utils.py failed to import InferenceHelper. Please ensure that AdaBins directory is in the path (i.e. via sys.path.append('./AdaBins') or other means).


ImportError                               Traceback (most recent call last)
Input In [56], in <cell line: 134>()
    142         wget("https://cloudflare-ipfs.com/ipfs/Qmd2mMnDLWePKmgfS8m6ntAg4nhV5VkUyAydYBp8cWWeB7/AdaBins_nyu.pt", f'{PROJECT_DIR}/pretrained')
    143     sys.path.append(f'{PROJECT_DIR}/AdaBins')
--> 144 from infer import InferenceHelper
    145 print(sys.path)
    146 MAX_ADABINS_AREA = 500000

ImportError: cannot import name 'InferenceHelper' from 'infer' (/home/ubuntu/.local/lib/python3.8/site-packages/infer/__init__.py)

YIN-Renlong avatar Jun 22 '22 11:06 YIN-Renlong

Solution: pip uninstall infer and restart kernel.

This will result in a conflict on the VM with the Infer already installed.

Hi @aletts , this could be a bug that you should look at fixing.

YIN-Renlong avatar Jun 22 '22 21:06 YIN-Renlong

I think you may have installed that one locally ( ? ). I remember seeing that once when I was initially integrating AdaBins in my local setup. I think infer is an unrelated module. I chose to avoid pip installing things locally since it might disturb peoples' environment. Instead, the code just does a git clone of the AdaBins source code and imports things from AdaBins/infer.py

So I think / hope Disco Diffusion doesn't have a problem there.

aletts avatar Jun 22 '22 21:06 aletts

Actually, I think I see what you're saying now. You may be saying that you have infer for a real reason - and that you want to be able to use Disco Diffusion while you have it installed. Annoyingly, AdaBins uses a few really common words in its filenames.. which makes it a little bit more difficult to import things from it when other modules using common names are around. I recently had a similar conflict between AdaBins and RAFT. If anyone's able to reliably import those files from the git cloned projects without conflicts without renaming files, I'd be happy.

aletts avatar Jun 22 '22 21:06 aletts

Hi @aletts , thanks for the reply, I would say yes, that is what I meant. Infer may be pre-installed on Ubuntu's system for certain reason. In this case, it will result in a fatal conflict with the DD installation.

Is it possible to think about a detection mechanism: uninstall or stop infer while DD is running, and then reinstall infer after DD has finished?

Best

YIN-Renlong avatar Jun 22 '22 21:06 YIN-Renlong

It'd be easiest for me to adjust DD's installation process for it.. to make it rename infer.py to adabins_infer.py or something. It's a hack, but it wouldn't be the first time I've done it.

aletts avatar Jun 22 '22 21:06 aletts

disco_xform_utils.py failed to import InferenceHelper. Please ensure that AdaBins directory is in the path (i.e. via sys.path.append('./AdaBins') or other means).

DD works, but I am still seeing this error (or warning ?). Should I ignore it ? It doesn't affect the generation process

BeaverInGreenland avatar Jul 22 '22 09:07 BeaverInGreenland

The AdaBins error can be misleading and hide other errors... See https://github.com/MohamadZeina/Disco_Diffusion_Local/issues/30#issuecomment-1341383387

illtellyoulater avatar Dec 07 '22 18:12 illtellyoulater