Skip to content

[Bugfix] Fix 'NoneType' AttributeError in stable-diffusion model detect#1254

Open
yma11 wants to merge 1 commit intovllm-project:mainfrom
yma11:diffusion
Open

[Bugfix] Fix 'NoneType' AttributeError in stable-diffusion model detect#1254
yma11 wants to merge 1 commit intovllm-project:mainfrom
yma11:diffusion

Conversation

@yma11
Copy link
Contributor

@yma11 yma11 commented Feb 6, 2026

PLEASE FILL IN THE PR DESCRIPTION HERE ENSURING ALL CHECKLIST ITEMS (AT THE BOTTOM) HAVE BEEN CONSIDERED.

Purpose

This PR is to fix NoneType attribute error which happens in diffusion model config parsing.

Traceback (most recent call last):
  File "/usr/local/bin/vllm", line 7, in <module>
    sys.exit(main())
             ^^^^^^
  File "/mnt/disk4/fanlilin/tmp2/vllm-omni/vllm_omni/entrypoints/cli/main.py", line 48, in main
    cmds[args.subparser].validate(args)
  File "/mnt/disk4/fanlilin/tmp2/vllm-omni/vllm_omni/entrypoints/cli/serve.py", line 59, in validate
    if model and is_diffusion_model(model):
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/disk4/fanlilin/tmp2/vllm-omni/vllm_omni/diffusion/utils/hf_utils.py", line 79, in is_diffusion_model
    return _looks_like_bagel(model_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/disk4/fanlilin/tmp2/vllm-omni/vllm_omni/diffusion/utils/hf_utils.py", line 23, in _looks_like_bagel
    model_type = cfg.get("model_type")
                 ^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

Test Plan

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft.

BEFORE SUBMITTING, PLEASE READ https://github.com/vllm-project/vllm-omni/blob/main/CONTRIBUTING.md (anything written below this line will be removed by GitHub Actions)

@yma11 yma11 requested a review from hsliuustc0106 as a code owner February 6, 2026 14:49
@hsliuustc0106
Copy link
Collaborator

@princepride PTAL

@princepride
Copy link
Contributor

@yma11 Thanks for your contribute, lgtm, Did you encounter this error while using this model: https://huggingface.co/stabilityai/stable-diffusion-3.5-controlnets/blob/main/config.json? This model has a config file, but it's empty.😅

@yma11
Copy link
Contributor Author

yma11 commented Feb 7, 2026

@yma11 Thanks for your contribute, lgtm, Did you encounter this error while using this model: https://huggingface.co/stabilityai/stable-diffusion-3.5-controlnets/blob/main/config.json? This model has a config file, but it's empty.😅

Yes. This model will pop error:

(APIServer pid=22895)   File "/mnt/disk4/fanlilin/tmp2/vllm-omni/vllm_omni/entrypoints/utils.py", line 154, in resolve_model_config_path
(APIServer pid=22895)     config_dict = get_hf_file_to_dict("config.json", model, revision=None)
(APIServer pid=22895)                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=22895)   File "/usr/local/lib/python3.12/dist-packages/vllm/transformers_utils/repo_utils.py", line 285, in get_hf_file_to_dict
(APIServer pid=22895)     return json.load(file)
(APIServer pid=22895)            ^^^^^^^^^^^^^^^
(APIServer pid=22895)   File "/usr/lib/python3.12/json/__init__.py", line 293, in load
(APIServer pid=22895)     return loads(fp.read(),
(APIServer pid=22895)            ^^^^^^^^^^^^^^^^
(APIServer pid=22895)   File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
(APIServer pid=22895)     return _default_decoder.decode(s)
(APIServer pid=22895)            ^^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=22895)   File "/usr/lib/python3.12/json/decoder.py", line 338, in decode
(APIServer pid=22895)     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
(APIServer pid=22895)                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=22895)   File "/usr/lib/python3.12/json/decoder.py", line 356, in raw_decode
(APIServer pid=22895)     raise JSONDecodeError("Expecting value", s, err.value) from None
(APIServer pid=22895) json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

But I think this is an model issue that it's lack of necessary model config info. We need to make some work around for this model specifically. Will it make sense? if so, I can do it in another PR.

@princepride
Copy link
Contributor

@yma11 Thanks for your contribute, lgtm, Did you encounter this error while using this model: https://huggingface.co/stabilityai/stable-diffusion-3.5-controlnets/blob/main/config.json? This model has a config file, but it's empty.😅

Yes. This model will pop error:

(APIServer pid=22895)   File "/mnt/disk4/fanlilin/tmp2/vllm-omni/vllm_omni/entrypoints/utils.py", line 154, in resolve_model_config_path
(APIServer pid=22895)     config_dict = get_hf_file_to_dict("config.json", model, revision=None)
(APIServer pid=22895)                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=22895)   File "/usr/local/lib/python3.12/dist-packages/vllm/transformers_utils/repo_utils.py", line 285, in get_hf_file_to_dict
(APIServer pid=22895)     return json.load(file)
(APIServer pid=22895)            ^^^^^^^^^^^^^^^
(APIServer pid=22895)   File "/usr/lib/python3.12/json/__init__.py", line 293, in load
(APIServer pid=22895)     return loads(fp.read(),
(APIServer pid=22895)            ^^^^^^^^^^^^^^^^
(APIServer pid=22895)   File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
(APIServer pid=22895)     return _default_decoder.decode(s)
(APIServer pid=22895)            ^^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=22895)   File "/usr/lib/python3.12/json/decoder.py", line 338, in decode
(APIServer pid=22895)     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
(APIServer pid=22895)                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(APIServer pid=22895)   File "/usr/lib/python3.12/json/decoder.py", line 356, in raw_decode
(APIServer pid=22895)     raise JSONDecodeError("Expecting value", s, err.value) from None
(APIServer pid=22895) json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

But I think this is an model issue that it's lack of necessary model config info. We need to make some work around for this model specifically. Will it make sense? if so, I can do it in another PR.

I believe that if this file is necessary, the best approach is to let sd provide the correct config.json file. We don't need to do any special adaptation for this incorrect model file.

@yma11
Copy link
Contributor Author

yma11 commented Feb 7, 2026

But I think this is an model issue that it's lack of necessary model config info. We need to make some work around for this model specifically. Will it make sense? if so, I can do it in another PR.

I believe that if this file is necessary, the best approach is to let sd provide the correct config.json file. We don't need to do any special adaptation for this incorrect model file.

Agree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants