StableCascade
StableCascade copied to clipboard
File not found (but it is there!)
Things that went great:
- Cloning
git clone https://github.com/Stability-AI/StableCascade
- installing a venv
python3 -m venv ./venv
- activating the venv
source ./venv/bin/activate
- installing the python notebook
./venv/bin/pip3 install jupyter
- installing the requirements
./venv/bin/pip3 install -r requirements.txt
- downloading the inference files
cd models; bash download_models.sh essential big-big float32
- configuring the notebook to allow me to connect (the machine with the GPU is headless)
./venv/bin/python3 -m notebook --generate-config
+ https://stackoverflow.com/questions/39155953/exposing-python-jupyter-on-lan - Running the notebook.
./venv/bin/python3 -m notebook --ip 192.168.1.5 --port 8888
- Setting the notebook to "trusted"
Where I got stuck: the second code block couldn't read the file, even though I checked and it is there.
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[6], line 3
1 # SETUP STAGE C
2 config_file = 'configs/inference/stage_c_3b.yaml'
----> 3 with open(config_file, "r", encoding="utf-8") as file:
4 loaded_config = yaml.safe_load(file)
6 core = WurstCoreC(config_dict=loaded_config, device=device, training=False)
File ~/StableCascade/venv/lib/python3.11/site-packages/IPython/core/interactiveshell.py:310, in _modified_open(file, *args, **kwargs)
303 if file in {0, 1, 2}:
304 raise ValueError(
305 f"IPython won't let you open fd={file} by default "
306 "as it is likely to crash IPython. If you know what you are doing, "
307 "you can use builtins' open."
308 )
--> 310 return io_open(file, *args, **kwargs)
FileNotFoundError: [Errno 2] No such file or directory: 'configs/inference/stage_c_3b.yaml'
There's an os.chdir ".." in the first(?) cell, I believe the notebook assumes you launched from inside the inference folder. Try commenting it out or just setting your cascade folder directly.
Hey that helped, thank you @throttlekitty ! I got one more step, after downloading a file it fails with:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[3], line 3
1 # SETUP MODELS & DATA
2 extras = core.setup_extras_pre()
----> 3 models = core.setup_models(extras)
4 models.generator.eval().requires_grad_(False)
5 print("STAGE C READY")
File ~/StableCascade/train/train_c.py:163, in WurstCore.setup_models(self, extras)
161 generator.load_state_dict(load_or_fail(self.config.generator_checkpoint_path))
162 else:
--> 163 for param_name, param in load_or_fail(self.config.generator_checkpoint_path).items():
164 set_module_tensor_to_device(generator, param_name, "cpu", value=param)
165 generator = generator.to(dtype).to(self.device)
AttributeError: 'NoneType' object has no attribute 'items'
Likely the same problem I had at first. Check that the config filenames match the models you downloaded. It's set to use models/stage_#_bf16.safetensors.
@throttlekitty interesting! Letsee.
~/StableCascade$ PYTHONPATH=./ ./venv/bin/python3 gradio_app/app.py
2024-02-17 01:15:23.583230: I external/local_tsl/tsl/cuda/cudart_stub.cc:32] Could not find cuda drivers on your machine, GPU will not be used.
Hey, not cool, yes they are...
(venv) me@tower:~/StableCascade$ ./venv/bin/python3
Python 3.11.4 (main, Dec 7 2023, 15:43:41) [GCC 12.3.0] on linux
>>> import torch
>>> print(f'\nAvailable cuda = {torch.cuda.is_available()}')
Available cuda = True
>>> print(f'\nGPUs availables = {torch.cuda.device_count()}')
GPUs availables = 1
>>> print(f'\nCurrent device = {torch.cuda.current_device()}')
Current device = 0
>>> print(f'\nCurrent Device location = {torch.cuda.device(0)}')
Current Device location = <torch.cuda.device object at 0x7fad6cb674d0>
>>> print(f'\nName of the device = {torch.cuda.get_device_name(0)}')
Name of the device = NVIDIA GeForce GTX 1080 Ti
Yay CUDA is installed. So why does it say it isn't. odd.
Back to standard notebook, back to your hint: 6251950402 Feb 13 15:22 stage_b.safetensors
oh hey!
- Look at that
dtype: bfloat16
Changing it to 32. - and
models/stage_c_bf16.safetensors
- removing the_bf16
oops. The dtype: bfloat16
should stay that way.
Hey it got more steps! Cool! (Wow I'm really not used to python notebooks - it is strange not seeing what step is still running)