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

Error running job: 'QLinear' object has no attribute 'qweight' #193

Open
Joir-Jio opened this issue Oct 9, 2024 · 3 comments
Open

Error running job: 'QLinear' object has no attribute 'qweight' #193

Joir-Jio opened this issue Oct 9, 2024 · 3 comments

Comments

@Joir-Jio
Copy link

Joir-Jio commented Oct 9, 2024

This is for bugs only

Did you already ask in the discord?

YOU RECEIVEDANINVITE,BU.
Invalid Invite
Askbuffy foranew invite!

You verified that this is a bug and not a feature request or question by asking in the discord?

YOU RECEIVEDANINVITE,BU.
Invalid Invite
Askbuffy foranew invite!

Describe the bug

(ai-toolkit) C:\LYF\dev\ai-toolkit>python run.py config/train_lora_flux_24gb.yaml
Running 1 job
C:\Users\david\anaconda3\envs\ai-toolkit\Lib\site-packages\controlnet_aux\segment_anything\modeling\tiny_vit_sam.py:654: UserWarning: Overwriting tiny_vit_5m_224 in registry with controlnet_aux.segment_anything.modeling.tiny_vit_sam.tiny_vit_5m_224. This is because the name being registered conflicts with an existing name. Please check if this is not expected.
  return register_model(fn_wrapper)
C:\Users\david\anaconda3\envs\ai-toolkit\Lib\site-packages\controlnet_aux\segment_anything\modeling\tiny_vit_sam.py:654: UserWarning: Overwriting tiny_vit_11m_224 in registry with controlnet_aux.segment_anything.modeling.tiny_vit_sam.tiny_vit_11m_224. This is because the name being registered conflicts with an existing name. Please check if this is not expected.
  return register_model(fn_wrapper)
C:\Users\david\anaconda3\envs\ai-toolkit\Lib\site-packages\controlnet_aux\segment_anything\modeling\tiny_vit_sam.py:654: UserWarning: Overwriting tiny_vit_21m_224 in registry with controlnet_aux.segment_anything.modeling.tiny_vit_sam.tiny_vit_21m_224. This is because the name being registered conflicts with an existing name. Please check if this is not expected.
  return register_model(fn_wrapper)
C:\Users\david\anaconda3\envs\ai-toolkit\Lib\site-packages\controlnet_aux\segment_anything\modeling\tiny_vit_sam.py:654: UserWarning: Overwriting tiny_vit_21m_384 in registry with controlnet_aux.segment_anything.modeling.tiny_vit_sam.tiny_vit_21m_384. This is because the name being registered conflicts with an existing name. Please check if this is not expected.
  return register_model(fn_wrapper)
C:\Users\david\anaconda3\envs\ai-toolkit\Lib\site-packages\controlnet_aux\segment_anything\modeling\tiny_vit_sam.py:654: UserWarning: Overwriting tiny_vit_21m_512 in registry with controlnet_aux.segment_anything.modeling.tiny_vit_sam.tiny_vit_21m_512. This is because the name being registered conflicts with an existing name. Please check if this is not expected.
  return register_model(fn_wrapper)
{
    "type": "sd_trainer",
    "training_folder": "output",
    "device": "cuda:0",
    "trigger_word": "urpants",
    "network": {
        "type": "lora",
        "linear": 32,
        "linear_alpha": 16
    },
    "save": {
        "dtype": "float16",
        "save_every": 500,
        "max_step_saves_to_keep": 10,
        "push_to_hub": false
    },
    "datasets": [
        {
            "folder_path": "C:\\Users\\david\\Desktop\\product(1)\\dabiao",
            "caption_ext": "txt",
            "caption_dropout_rate": 0.05,
            "shuffle_tokens": false,
            "cache_latents_to_disk": true,
            "resolution": [
                1024
            ]
        }
    ],
    "train": {
        "batch_size": 1,
        "steps": 2000,
        "gradient_accumulation_steps": 1,
        "train_unet": true,
        "train_text_encoder": false,
        "gradient_checkpointing": true,
        "noise_scheduler": "flowmatch",
        "optimizer": "adamw8bit",
        "lr": 0.0001,
        "ema_config": {
            "use_ema": true,
            "ema_decay": 0.99
        },
        "dtype": "bf16"
    },
    "model": {
        "name_or_path": "C:\\LYF\\dev\\ai-toolkit\\FLUX",
        "is_flux": true,
        "quantize": true
    },
    "sample": {
        "sampler": "flowmatch",
        "sample_every": 500,
        "width": 1024,
        "height": 1024,
        "prompts": [
            "a woman with red hair, wearing a urpants, playing chess at the park",
            "a woman holding a coffee cup,wearing a urpants, sitting at a cafe"
        ],
        "neg": "",
        "seed": 42,
        "walk_seed": true,
        "guidance_scale": 4,
        "sample_steps": 20
    }
}
Using EMA
C:\LYF\dev\ai-toolkit\extensions_built_in\sd_trainer\SDTrainer.py:61: FutureWarning: `torch.cuda.amp.GradScaler(args...)` is deprecated. Please use `torch.amp.GradScaler('cuda', args...)` instead.
  self.scaler = torch.cuda.amp.GradScaler()

#############################################
# Running job: urpants
#############################################


Running  1 process
Loading Flux model
Loading transformer
Quantizing transformer
C:\Users\david\anaconda3\envs\ai-toolkit\Lib\site-packages\torch\utils\cpp_extension.py:1966: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation.
If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
  warnings.warn(
Error running job: 'QLinear' object has no attribute 'qweight'

========================================
Result:
 - 0 completed jobs
 - 1 failure
========================================
Traceback (most recent call last):
  File "C:\LYF\dev\ai-toolkit\run.py", line 90, in <module>
    main()
  File "C:\LYF\dev\ai-toolkit\run.py", line 86, in main
    raise e
  File "C:\LYF\dev\ai-toolkit\run.py", line 78, in main
    job.run()
  File "C:\LYF\dev\ai-toolkit\jobs\ExtensionJob.py", line 22, in run
    process.run()
  File "C:\LYF\dev\ai-toolkit\jobs\process\BaseSDTrainProcess.py", line 1241, in run
    self.sd.load_model()
  File "C:\LYF\dev\ai-toolkit\toolkit\stable_diffusion_model.py", line 612, in load_model
    freeze(transformer)
  File "C:\Users\david\anaconda3\envs\ai-toolkit\Lib\site-packages\optimum\quanto\quantize.py", line 146, in freeze
    m.freeze()
  File "C:\Users\david\anaconda3\envs\ai-toolkit\Lib\site-packages\optimum\quanto\nn\qmodule.py", line 299, in freeze
    qweight = self.qweight
              ^^^^^^^^^^^^
  File "C:\Users\david\anaconda3\envs\ai-toolkit\Lib\site-packages\torch\nn\modules\module.py", line 1729, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'QLinear' object has no attribute 'qweight'. Did you mean: 'weight'?
@Joir-Jio
Copy link
Author

Joir-Jio commented Oct 9, 2024

my device is win11 and 4090 24G

@Haydn-Mann
Copy link

I am having the same issue

@Imranazeb
Copy link

Imranazeb commented Oct 10, 2024

A lot of things broke because optimum-quanto version changed. Try pip uninstall optimum-quanto and then pip install optimum-quanto==0.2.4. A lot of errors were resolved. I have made a suggestion in the discord that dev should list versions in the requirements file.

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

3 participants