TheLastBen / fast-stable-diffusion

fast-stable-diffusion + DreamBooth
MIT License
7.49k stars 1.3k forks source link

Access denied errors with checkpoints #1642

Open Taikakim opened 1 year ago

Taikakim commented 1 year ago

https://ibb.co/5r7KkCm

Hmm I guess I can't embed an image here?

Anyway, in the recent days I've been getting permission errors on the model directory, which is weird since I'm logged into my Drive.

That extra subdirectory is there just so I'm trying to differentiate between 1.5 and 2.1 models. The same problem happens even with the root directory of the models.

Taikakim commented 1 year ago

I deleted everything and ran from a clear slate, now things seem to work again :)

Taikakim commented 1 year ago

Oh, it worked once, but not anymore...

Trying to switch to my own trained model after a clean install and re-downloading the 768px model:

✔ Connected
changing setting sd_model_checkpoint to v2-768-avalon604x.ckpt [9db3f04b83]: KeyError
Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/shared.py", line 554, in set
    self.data_labels[key].onchange()
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 15, in f
    res = func(*args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py", line 120, in <lambda>
    shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: modules.sd_models.reload_model_weights()))
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_models.py", line 464, in reload_model_weights
    state_dict = get_checkpoint_state_dict(checkpoint_info, timer)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_models.py", line 229, in get_checkpoint_state_dict
    sd_model_hash = checkpoint_info.calculate_shorthash()
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_models.py", line 70, in calculate_shorthash
    checkpoints_list.pop(self.title)
KeyError: 'v2-768-avalon604x.ckpt [9db3f04b83]'

Also, can't directly give a directory or file link in the cell in the notebook, getting those same acces denied errors again. It's even a different computer and OS now, so it can't be the browser misbehaving or something.

Taikakim commented 1 year ago

Ok, weird, after some error messages, it's now loaded and rendering:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/gradio/routes.py", line 337, in run_predict
    output = await app.get_blocks().process_api(
  File "/usr/local/lib/python3.8/dist-packages/gradio/blocks.py", line 1015, in process_api
    result = await self.call_function(
  File "/usr/local/lib/python3.8/dist-packages/gradio/blocks.py", line 833, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/usr/local/lib/python3.8/dist-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 15, in f
    res = func(*args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/ui.py", line 277, in update_token_counter
    token_count, max_length = max([model_hijack.get_prompt_lengths(prompt) for prompt in prompts], key=lambda args: args[0])
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/ui.py", line 277, in <listcomp>
    token_count, max_length = max([model_hijack.get_prompt_lengths(prompt) for prompt in prompts], key=lambda args: args[0])
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_hijack.py", line 207, in get_prompt_lengths
    _, token_count = self.clip.process_texts([text])
AttributeError: 'NoneType' object has no attribute 'process_texts'
INFO:sd_dynamic_prompts.dynamic_prompting:Prompt matrix will create 1 images in a total of 1 batches.
Error completing request
Arguments: ('task(qn0pl877lcljtu0)', 'testing psychedelica', '', [], 20, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, [], 0, True, False, 1, False, False, False, 1.1, 1.5, 100, 0.7, False, False, True, False, False, 0, 'Gustavosta/MagicPrompt-Stable-Diffusion', '', False, False, 'none', 'None', 1, None, False, 'Scale to Fit (Inner Fit)', False, False, 64, 64, 64, 0, 1, False, False, False, 'positive', 'comma', 0, False, False, '', 1, '', 0, '', 0, '', True, False, False, False, 0, None, 50) {}
Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/txt2img.py", line 56, in txt2img
    processed = process_images(p)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 486, in process_images
    res = process_images_inner(p)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 621, in process_images_inner
    uc = get_conds_with_caching(prompt_parser.get_learned_conditioning, negative_prompts, p.steps, cached_uc)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 570, in get_conds_with_caching
    cache[1] = function(shared.sd_model, required_prompts, steps)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/prompt_parser.py", line 140, in get_learned_conditioning
    conds = model.get_learned_conditioning(texts)
  File "/content/gdrive/MyDrive/sd/stablediffusion/ldm/models/diffusion/ddpm.py", line 665, in get_learned_conditioning
    c = self.cond_stage_model.encode(c)
  File "/content/gdrive/MyDrive/sd/stablediffusion/ldm/modules/encoders/modules.py", line 193, in encode
    return self(text)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/content/gdrive/MyDrive/sd/stablediffusion/ldm/modules/encoders/modules.py", line 170, in forward
    z = self.encode_with_transformer(tokens.to(self.device))
  File "/content/gdrive/MyDrive/sd/stablediffusion/ldm/modules/encoders/modules.py", line 174, in encode_with_transformer
    x = self.model.token_embedding(text)  # [batch_size, n_ctx, d_model]
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/sparse.py", line 160, in forward
    return F.embedding(
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/functional.py", line 2210, in embedding
    return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument index in method wrapper__index_select)

Calculating sha256 for /content/gdrive/MyDrive/sd/stable-diffusion-webui/models/Stable-diffusion/avalon604x_step_1000.ckpt: 1474916ced9e40d64e48a6b26cb5ee21646b6c59e868a98b5d216b17e0c86768
Loading weights [1474916ced] from /content/gdrive/MyDrive/sd/stable-diffusion-webui/models/Stable-diffusion/avalon604x_step_1000.ckpt
Applying xformers cross attention optimization.
Weights loaded in 75.6s (calculate hash: 47.3s, load weights from disk: 17.9s, find config: 7.1s, apply weights to model: 1.6s, move model to device: 1.7s).
INFO:sd_dynamic_prompts.dynamic_prompting:Prompt matrix will create 1 images in a total of 1 batches.
100% 20/20 [00:10<00:00,  1.98it/s]
Taikakim commented 1 year ago

Hmm, it's also possible that the prompt wildcard extension was causing a problem recently...