lllyasviel / lllyasviel/stable-diffusion-webui-forge
Failed to recognize model type/Linear(): argument 'weight' (position 2) must be Tensor, not NoneType
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
So, I was trying to use ControlNet to make Lineworks of some art I made on paper, after taking a photo of them. I tried to follow this guide:
https://www.youtube.com/watch?v=xlO1Av20-OY
I tried to do it using Automatic1111, but I ended up unistalling it, after that, I tried with Forge, I downloaded the two reccomended models for ControlNet (Canny and Lineart), and them I tried to do like in the video. However, no model I try really work.
I will admit my knowledge of this is very limited, but I attempted to use the ones powering this:
https://huggingface.co/spaces/tori29umai/sketch2lineart
Of which the result is the error message shown, in the prompt it gives the message:
> To create a public link, set `share=True` in `launch()`.
> Startup time: 25.0s (prepare environment: 4.6s, launcher: 0.7s, import torch: 10.9s, initialize shared: 0.2s, other imports: 0.5s, load scripts: 3.3s, create ui: 3.3s, gradio launch: 1.5s).
> Environment vars changed: {'stream': False, 'inference_memory': 1024.0, 'pin_shared_memory': False}
> [GPU Setting] You will use 87.49% GPU memory (7163.00 MB) to load weights, and use 12.51% GPU memory (1024.00 MB) to do matrix computation.
> Model selected: {'checkpoint_info': {'filename': 'C:\\Users\\marrr\\Downloads\\webui_forge_cu121_torch231\\webui\\models\\Stable-diffusion\\sdxl_BW_bold_Line.safetensors', 'hash': 'fdbdee3a'}, 'additional_modules': [], 'unet_storage_dtype': None}
> Using online LoRAs in FP16: False
> Loading Model: {'checkpoint_info': {'filename': 'C:\\Users\\marrr\\Downloads\\webui_forge_cu121_torch231\\webui\\models\\Stable-diffusion\\sdxl_BW_bold_Line.safetensors', 'hash': 'fdbdee3a'}, 'additional_modules': [], 'unet_storage_dtype': None}
> [Unload] Trying to free all memory for cuda:0 with 0 models keep loaded ... Done.
> Traceback (most recent call last):
> File "C:\Users\marrr\Downloads\webui_forge_cu121_torch231\webui\backend\loader.py", line 500, in forge_loader
> state_dicts, estimated_config = split_state_dict(sd, additional_state_dicts=additional_state_dicts)
> File "C:\Users\marrr\Downloads\webui_forge_cu121_torch231\webui\backend\loader.py", line 452, in split_state_dict
> guess = huggingface_guess.guess(sd)
> File "C:\Users\marrr\Downloads\webui_forge_cu121_torch231\webui\repositories\huggingface_guess\huggingface_guess\__init__.py", line 7, in guess
> result.unet_key_prefix = [unet_key_prefix]
> AttributeError: 'NoneType' object has no attribute 'unet_key_prefix'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "C:\Users\marrr\Downloads\webui_forge_cu121_torch231\webui\modules_forge\main_thread.py", line 30, in work
> self.result = self.func(*self.args, **self.kwargs)
> File "C:\Users\marrr\Downloads\webui_forge_cu121_torch231\webui\modules\img2img.py", line 248, in img2img_function
> processed = process_images(p)
> File "C:\Users\marrr\Downloads\webui_forge_cu121_torch231\webui\modules\processing.py", line 836, in process_images
> manage_model_and_prompt_cache(p)
> File "C:\Users\marrr\Downloads\webui_forge_cu121_torch231\webui\modules\processing.py", line 804, in manage_model_and_prompt_cache
> p.sd_model, just_reloaded = forge_model_reload()
> File "C:\Users\marrr\Downloads\webui_forge_cu121_torch231\system\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
> return func(*args, **kwargs)
> File "C:\Users\marrr\Downloads\webui_forge_cu121_torch231\webui\modules\sd_models.py", line 504, in forge_model_reload
> sd_model = forge_loader(state_dict, additional_state_dicts=additional_state_dicts)
> File "C:\Users\marrr\Downloads\webui_forge_cu121_torch231\system\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
> return func(*args, **kwargs)
> File "C:\Users\marrr\Downloads\webui_forge_cu121_torch231\webui\backend\loader.py", line 502, in forge_loader
> raise ValueError('Failed to recognize model type!')
> ValueError: Failed to recognize model type!
> Failed to recognize model type!
When using a model proper I was reccomended, which like the other two was sent to the Model/StableDifussion paste,
https://civitai.com/models/149599/boldlineanime
The error message, which is much bigger, is instead
> TypeError: linear(): argument 'weight' (position 2) must be Tensor, not NoneType
> linear(): argument 'weight' (position 2) must be Tensor, not NoneType
>
What Model should I replace for it?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the model-loading failure through backend/loader.py, repositories/huggingface_guess, and modules/sd_models.py using the supplied traceback and model paths. Reproduce with the cited Stable Diffusion and ControlNet models, then determine whether the failure is caused by model compatibility or loading; done means the supported model loads without either reported exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100