nasimjamshidi / LAR-IQA

42 stars 3 forks source link

KeyError: 'learning_rate' #7

Open GZHU-DVL opened 1 week ago

GZHU-DVL commented 1 week ago

ubuntu:/data1/fengchuang/LAR-IQA-main$ python scripts/main.py --csv_files /data1/fengchuang/LAR-IQA-main/dataset/training.csv --root_dirs /data1/fengchuang/UHD-IQA-database/UHD --val_csv_file /data1/fengchuang/LAR-IQA-main/dataset/validation.csv --val_root_dir /data1/fengchuang/UHD-IQA-database/UHD --output_path /data1/fengchuang/UHD-IQA-database/ --batch_size 8 --use_kan
wandb: Using wandb-core as the SDK backend. Please refer to https://wandb.me/wandb-core for more information. wandb: Currently logged in as: fengchuang (dvl536). Use wandb login --relogin to force relogin wandb: Tracking run with wandb version 0.18.6 wandb: Run data is saved locally in /data1/fengchuang/LAR-IQA-main/wandb/run-20241112_061206-1kxsvr2l wandb: Run wandb offline to turn off syncing. wandb: Syncing run prime-shape-5 wandb: ?? View project at https://wandb.ai/dvl536/my_project wandb: ?? View run at https://wandb.ai/dvl536/my_project/runs/1kxsvr2l Traceback (most recent call last): File "/data1/fengchuang/anaconda3/envs/kann/lib/python3.9/site-packages/wandb/sdk/wandb_config.py", line 165, in getattr return self.getitem(key) File "/data1/fengchuang/anaconda3/envs/kann/lib/python3.9/site-packages/wandb/sdk/wandb_config.py", line 130, in getitem return self._items[key] KeyError: 'learning_rate'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/data1/fengchuang/LAR-IQA-main/scripts/../utils/train.py", line 142, in train optimizer, scheduler = build_optimizer_and_scheduler(model, config, {"train_loader": train_loader}) File "/data1/fengchuang/LAR-IQA-main/scripts/../utils/train.py", line 44, in build_optimizer_and_scheduler lr= config.learning_rate, File "/data1/fengchuang/anaconda3/envs/kann/lib/python3.9/site-packages/wandb/sdk/wandb_config.py", line 167, in getattr raise AttributeError( AttributeError: <class 'wandb.sdk.wandb_config.Config'> object has no attribute 'learning_rate'

When I use the following command: python scripts/main.py --csv_files /data1/fengchuang/LAR-IQA-main/dataset/training.csv --root_dirs /data1/fengchuang/UHD-IQA-database/UHD --val_csv_file /data1/fengchuang/LAR-IQA-main/dataset/validation.csv --val_root_dir /data1/fengchuang/UHD-IQA-database/UHD --output_path /data1/fengchuang/UHD-IQA-database/ --batch_size 8, an error occurs. How can I resolve this issue?

nasimjamshidi commented 1 week ago

@GZHU-DVL, Thank you for your question. I’ll go through the code to find a solution to your issue. I’m a bit busy for the next two days, but I’ll get back to you afterward.

GZHU-DVL commented 1 week ago

Ok, waiting for U

ChengL226 commented 1 week ago

ubuntu:/data1/fengchuang/LAR-IQA-main$ python脚本/main.py --csv_files /data1/fengchuang/LAR-IQA-main/dataset/training.csv --root_dirs /data1/fengchuang/UHD-IQA-数据库/UHD --val_csv_file /data1/fengchuang/LAR-IQA-main/dataset/validation.csv --val_root_dir /data1/fengchuang/UHD-IQA-database/UHD --output_path /data1/fengchuang/UHD-IQA-database / --batch_size 8 --use_kan wandb:使用 wandb-core 作为 SDK ,详细信息 请参考https:// wandb.me/wandb-core wandb:当前登录身份:fengchuang (dvl536)。为wandb login --relogin强制重新登录 wandb:使用wandb版本0.18.6跟踪运行 wandb:运行数据本地保存在/data1/fengchuang/LAR-IQA-main/wandb/run-20241112_061206- 1kxsvr2l wandb:运行wandb offline以关闭同步。 wandb:同步运行 prime-shape-5万达:?? 在https://wandb.ai/dvl536/my_project 查看项目wandb:?? 在https://wandb.ai/dvl536/my_project/runs/1kxsvr2l 查看运行 回溯(最近一次调用最后一次): 文件“/data1/fengchuang/anaconda3/envs/kann/lib/python3.9/site-packages/ wandb/sdk/wandb_config.py”,第165行,在getattr中返回self。getitem (key) 文件“/data1/fengchuang/anaconda3/envs/kann/lib/python3.9/site-packages/wandb/sdk/wandb_config.py”,第130行,在getitem中返回self._items[key] KeyError : '学习率'****

问题异常是导致以下异常的直接原因:

回溯(最近一次调用最后一次): 文件“/data1/fengchuang/LAR-IQA-main/scripts/../utils/train.py”,第142行,在训练 优化器中,调度程序 = build_optimizer_and_scheduler(model) ) ,config,{“train_loader”:train_loader}) 文件“/data1/fengchuang/LAR-IQA-main/scripts/../utils/train.py”,第44行,在build_optimizer_and_scheduler lr = config.learning_rate, 文件“ /data1/fengchuang/anaconda3/envs/kann/lib/python3.9/site-packages/wandb/sdk/wandb_config.py”,第167行,在getattr中引发AttributeError( AttributeError:<class 'wandb.sdk.wandb_config) ) .Config'> 对象没有属性'learning_rate'

当我使用以下命令时:python scripts/main.py --csv_files /data1/fengchuang/LAR-IQA-main/dataset/training.csv --root_dirs /data1/fengchuang/UHD-IQA-database/UHD --val_csv_file /data1/fengchuang/LAR-IQA-main/dataset/validation.csv --val_root_dir /data1/fengchuang/UHD-IQA-database/UHD --output_path /data1/fengchuang/UHD-IQA-database/ --batch_size 8 时,出现错误。我解决了这个问题吗?

I also encountered the same problem, have you solved it?

nasimjamshidi commented 1 week ago

Hi @ChengL226 , @GZHU-DVL , could you please enable the W&B sweep to check if it resolves the issue? I plan to update it to run without the sweep eventually. You can enable the W&B sweep by setting the use_sweep variable.

ChengL226 commented 1 week ago

你好@ChengL226,@GZHU-DVL,您能否启用 W&B 扫描来检查它是否解决了问题?我计划最终将其更新为无需扫描即可运行。您可以通过设置 use_sweep 变量来启用 W&B 扫描。

@nasimjamshidi I tried using the use_sweek method, but it reported other errors

Traceback (most recent call last): File "/data/cl/LAR-IQA/scripts/../utils/train.py", line 152, in train avg_train_loss = train_epoch(model, train_loader, optimizer, scheduler, l2loss, plccloss, weights, config.color_space) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/cl/LAR-IQA/scripts/../utils/train.py", line 93, in train_epoch scheduler.step() File "/data/cl/LAR-IQA/venv/lib/python3.12/site-packages/torch/optim/lr_scheduler.py", line 238, in step values = self.get_lr() ^^^^^^^^^^^^^ File "/data/cl/LAR-IQA/venv/lib/python3.12/site-packages/torch/optim/lr_scheduler.py", line 385, in get_lr base_lr lmbda(self.last_epoch) ^^^^^^^^^^^^^^^^^^^^^^ File "/data/cl/LAR-IQA/scripts/../utils/train.py", line 59, in else 0.5 (1 + torch.cos(torch.pi (cur_iter - warmup_iter) / (max_iter - warmup_iter))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: cos(): argument 'input' (position 1) must be Tensor, not float Traceback (most recent call last): File "/data/cl/LAR-IQA/scripts/main.py", line 36, in train_with_config train(config) File "/data/cl/LAR-IQA/scripts/../utils/train.py", line 152, in train avg_train_loss = train_epoch(model, train_loader, optimizer, scheduler, l2loss, plccloss, weights, config.color_space) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/cl/LAR-IQA/scripts/../utils/train.py", line 93, in train_epoch scheduler.step() File "/data/cl/LAR-IQA/venv/lib/python3.12/site-packages/torch/optim/lr_scheduler.py", line 238, in step values = self.get_lr() ^^^^^^^^^^^^^ File "/data/cl/LAR-IQA/venv/lib/python3.12/site-packages/torch/optim/lr_scheduler.py", line 385, in get_lr base_lr lmbda(self.last_epoch) ^^^^^^^^^^^^^^^^^^^^^^ File "/data/cl/LAR-IQA/scripts/../utils/train.py", line 59, in else 0.5 (1 + torch.cos(torch.pi (cur_iter - warmup_iter) / (max_iter - warmup_iter))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: cos(): argument 'input' (position 1) must be Tensor, not float