lyhue1991 / torchkeras

Pytorch❤️ Keras 😋😋
Apache License 2.0
1.5k stars 197 forks source link

AttributeError: 'Parameter' object has no attribute 'weight' #76

Closed Lxhnnn closed 7 months ago

Lxhnnn commented 7 months ago

home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/utils/checkpoint.py:429: UserWarning: torch.utils.checkpoint: please pass in use_reentrant=True or use_reentrant=False explicitly. The default value of use_reentrant will be updated to be False in the future. To maintain current behavior, pass use_reentrant=True. It is recommended that you use use_reentrant=False. Refer to docs for more details on the differences between the two variants. warnings.warn( Traceback (most recent call last): File "/data/huangtt/OSINT/OSINT_func/0_test/torchkeras/QwenQlora/Qlora.py", line 268, in keras_model.fit(train_data = dl_train, File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torchkeras/kerasmodel.py", line 212, in fit train_metrics.update(train_epoch_runner(train_dataloader)) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torchkeras/kerasmodel.py", line 78, in call step_losses,step_metrics = self.steprunner(batch) File "/data/huangtt/OSINT/OSINT_func/0_test/torchkeras/QwenQlora/Qlora.py", line 214, in call loss = self.net.forward(batch)[0] File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/peft/peft_model.py", line 977, in forward return self.base_model( File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(args, kwargs) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/peft/tuners/adalora/model.py", line 237, in forward outputs = self.model.forward(*args, kwargs) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/accelerate/hooks.py", line 164, in new_forward output = module._old_forward(*args, *kwargs) File "/home/ant/.cache/huggingface/modules/transformers_modules/Qwen-7B/modeling_qwen.py", line 1058, in forward transformer_outputs = self.transformer( File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, kwargs) File "/home/ant/.cache/huggingface/modules/transformers_modules/Qwen-7B/modeling_qwen.py", line 878, in forward outputs = torch.utils.checkpoint.checkpoint( File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/_compile.py", line 24, in inner return torch._dynamo.disable(fn, recursive)(*args, *kwargs) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 328, in _fn return fn(args, kwargs) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/_dynamo/external_utils.py", line 17, in inner return fn(*args, kwargs) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/utils/checkpoint.py", line 451, in checkpoint return CheckpointFunction.apply(function, preserve, args) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/autograd/function.py", line 539, in apply return super().apply(args, kwargs) # type: ignore[misc] File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/utils/checkpoint.py", line 230, in forward outputs = run_function(args) File "/home/ant/.cache/huggingface/modules/transformers_modules/Qwen-7B/modeling_qwen.py", line 874, in custom_forward return module(inputs, use_cache, output_attentions) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, kwargs) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/accelerate/hooks.py", line 164, in new_forward output = module._old_forward(args, kwargs) File "/home/ant/.cache/huggingface/modules/transformers_modules/Qwen-7B/modeling_qwen.py", line 609, in forward attn_outputs = self.attn( File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, kwargs) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/accelerate/hooks.py", line 164, in new_forward output = module._old_forward(args, kwargs) File "/home/ant/.cache/huggingface/modules/transformers_modules/Qwen-7B/modeling_qwen.py", line 420, in forward mixed_x_layer = self.c_attn(hidden_states) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(args, **kwargs) File "/home/ant/anaconda3/envs/lxh310/lib/python3.10/site-packages/peft/tuners/adalora/bnb.py", line 144, in forward compute_dtype = lora_A.weight.dtype AttributeError: 'Parameter' object has no attribute 'weight'

Lxhnnn commented 7 months ago

训练Qwen-7B的时候