Skip to content

AttributeError: Can't get attribute 'PlainAQTLayout' #1373

@nitinmukesh

Description

@nitinmukesh

How to fix this

(venv) C:\aiai\OminiControl>python -m src.gradio.gradio_app
C:\aiai\OminiControl\venv\lib\site-packages\accelerate\utils\modeling.py:1513: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  return torch.load(checkpoint_file, map_location=torch.device("cpu"))
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\aiai\OminiControl\src\gradio\gradio_app.py", line 115, in <module>
    init_pipeline()
  File "C:\aiai\OminiControl\src\gradio\gradio_app.py", line 22, in init_pipeline
    transformer_model = FluxTransformer2DModel.from_pretrained(
  File "C:\aiai\OminiControl\venv\lib\site-packages\huggingface_hub\utils\_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
  File "C:\aiai\OminiControl\venv\lib\site-packages\diffusers\models\modeling_utils.py", line 929, in from_pretrained
    raise e
  File "C:\aiai\OminiControl\venv\lib\site-packages\diffusers\models\modeling_utils.py", line 886, in from_pretrained
    accelerate.load_checkpoint_and_dispatch(
  File "C:\aiai\OminiControl\venv\lib\site-packages\accelerate\big_modeling.py", line 613, in load_checkpoint_and_dispatch
    load_checkpoint_in_model(
  File "C:\aiai\OminiControl\venv\lib\site-packages\accelerate\utils\modeling.py", line 1717, in load_checkpoint_in_model
    loaded_checkpoint = load_state_dict(checkpoint_file, device_map=device_map)
  File "C:\aiai\OminiControl\venv\lib\site-packages\accelerate\utils\modeling.py", line 1513, in load_state_dict
    return torch.load(checkpoint_file, map_location=torch.device("cpu"))
  File "C:\aiai\OminiControl\venv\lib\site-packages\torch\serialization.py", line 1360, in load
    return _load(
  File "C:\aiai\OminiControl\venv\lib\site-packages\torch\serialization.py", line 1848, in _load
    result = unpickler.load()
  File "C:\aiai\OminiControl\venv\lib\site-packages\torch\serialization.py", line 1837, in find_class
    return super().find_class(mod_name, name)
AttributeError: Can't get attribute 'PlainAQTLayout' on <module 'torchao.dtypes.affine_quantized_tensor' from 'C:\\aiai\\OminiControl\\venv\\lib\\site-packages\\torchao\\dtypes\\affine_quantized_tensor.py'>
(venv) C:\aiai\OminiControl>pip list
Package                   Version
------------------------- ---------------------
accelerate                1.1.1
diffusers                 0.31.0
torch                     2.5.1+cu124
torchao                   0.8.0.dev20241203+cpu
torchvision               0.20.1+cu124

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions