Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
nitinmukesh opened this issue Dec 3, 2024 · 5 comments
Closed

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

nitinmukesh opened this issue Dec 3, 2024 · 5 comments

Comments

@nitinmukesh
Copy link

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

@jainapurva
Copy link
Contributor

PlainAQTLayout has been renamed from PlainAQTLayout -> PlainAQTTensorImpl #1046, and moved to torchao/dtypes/uintx/plain_layout.py #1234
To import, please use:
from torchao.dtypes.uintx.plain_layout import PlainAQTTensorImpl

@jerryzh168
Copy link
Contributor

@nitinmukesh can you post the repro command

@nitinmukesh
Copy link
Author

@jerryzh168
Here is the repo I am trying to install
https://github.com/Yuanshi9815/OminiControl

@jerryzh168
Copy link
Contributor

@nitinmukesh sorry I meant the code to reproduce the error

@hlnull
Copy link

hlnull commented Jan 4, 2025

@nitinmukesh sorry I meant the code to reproduce the error

I encountered this error while running the code below.
image
https://github.com/Yuanshi9815/OminiControl/tree/main?tab=readme-ov-file#gradio-app

Hope it helps.

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

No branches or pull requests

4 participants