Stability-AI / StableCascade

Official Code for Stable Cascade
MIT License
6.53k stars 530 forks source link

File not found (but it is there!) #36

Open salamanders opened 7 months ago

salamanders commented 7 months ago

Things that went great:

  1. Cloning git clone https://github.com/Stability-AI/StableCascade
  2. installing a venv python3 -m venv ./venv
  3. activating the venv source ./venv/bin/activate
  4. installing the python notebook ./venv/bin/pip3 install jupyter
  5. installing the requirements ./venv/bin/pip3 install -r requirements.txt
  6. downloading the inference files cd models; bash download_models.sh essential big-big float32
  7. 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
  8. Running the notebook. ./venv/bin/python3 -m notebook --ip 192.168.1.5 --port 8888
  9. 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'
throttlekitty commented 7 months ago

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.

salamanders commented 7 months ago

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'
throttlekitty commented 7 months ago

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.

salamanders commented 7 months ago

@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!

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)