No module named 'scripts' when trying to do Inference
I am doing the inference part as the README step by step. But I suffered No module named 'scripts' when running
streamlit run scripts/demo/sampling.py --server.port <your_port>
Did anyone meet this issue and solve it?
The environment I choosed is pt2
I encountered the same problem, I don’t know how to solve
I have the same problem and don't know how to solve it
I had the same problem. It is due to python imports logic and the absence of the generative-models/ folder from the system path. I solved adding the following just before the problematic import in sampling.py:
import os, sys sys.path.append(os.path.abspath(os.path.join(os.path.dirname( __file__ ), '../..')))
It manually adds the main repo folder at the beginning of the sys path. There's probably a better way to solve this issue though
On most of my projects I've used this method to add an import path (execute when you are at the project's root folder):
echo $PWD > ~/anaconda3/envs/stability_py310/lib/python3.10/site-packages/stability_ai.pth
It's easier to just copy the demo script into the root folder of the repo and run it there.
The python system path might not have the current directory. Adding PYTHONPATH=. will resolve this:
PYTHONPATH=. streamlit run scripts/demo/sampling.py --server.port <your_port>
The python system path might not have the current directory. Adding
PYTHONPATH=.will resolve this:PYTHONPATH=. streamlit run scripts/demo/sampling.py --server.port <your_port>
it works!!!