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

评价指标报错 #41

Open
zhoulian-sudo opened this issue Jul 30, 2023 · 6 comments
Open

评价指标报错 #41

zhoulian-sudo opened this issue Jul 30, 2023 · 6 comments

Comments

@zhoulian-sudo
Copy link

您好,周梓康博士,感谢您杰出的代码贡献,想问下您评价指标处一直报这种错误是什么原因??
报错处:class ADE(Metric):

def __init__(self,
             compute_on_step: bool = True,
             dist_sync_on_step: bool = False,
             process_group: Optional[Any] = None,
             dist_sync_fn: Callable = None) -> None:
    super(ADE, self).__init__(compute_on_step=compute_on_step, dist_sync_on_step=dist_sync_on_step,
                              process_group=process_group, dist_sync_fn=dist_sync_fn)
    self.add_state('sum', default=torch.tensor(0.0), dist_reduce_fx='sum')
    self.add_state('count', default=torch.tensor(0), dist_reduce_fx='sum')

错误:
Global seed set to 2022
/home/amax/anaconda3/envs/haha/lib/python3.9/site-packages/pytorch_lightning/trainer/connectors/accelerator_connector.py:466: LightningDeprecationWarning: Setting Trainer(gpus=1) is deprecated in v1.7 and will be removed in v2.0. Please use Trainer(accelerator='gpu', devices=1) instead.
rank_zero_deprecation(
GPU available: True (cuda), used: True
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs
Traceback (most recent call last):
File "/data/project/HiVT-main/train.py", line 44, in
model = HiVT(**vars(args))
File "/data/project/HiVT-main/models/hivt.py", line 86, in init
self.minADE = ADE()
File "/data/project/HiVT-main/metrics/ade.py", line 27, in init
super(ADE, self).init(compute_on_step=compute_on_step, dist_sync_on_step=dist_sync_on_step,
File "/home/amax/anaconda3/envs/haha/lib/python3.9/site-packages/torchmetrics/metric.py", line 145, in init
raise ValueError(f"Unexpected keyword arguments: {', '.join(kwargs_)}")
ValueError: Unexpected keyword arguments: compute_on_step

@LL-C8
Copy link

LL-C8 commented Aug 6, 2023

@zhoulian-sudo 同样遇到了这个问题,请问解决了吗?

@zhoulian-sudo
Copy link
Author

zhoulian-sudo commented Aug 6, 2023 via email

@Lewis-Lu
Copy link

Hi there,

Could you please check the version of torchmetrics using pip list | grep torchmetrics.

As far as I know, Metrics has deprecate the compute_on_step parameter from certain version.

Thanks
Lewis

@xuyangwenhui
Copy link

I solved the same problem by using commod " pip install torchmetrics==0.8.2 ", maybe you could reference the issue " Lightning-AI/torchmetrics#789 "

@zhaozhen2333
Copy link

I solved the same problem by using commod " pip install torchmetrics==0.8.2 ", maybe you could reference the issue " Lightning-AI/torchmetrics#789 "

Thank you very much

@alien-HL
Copy link

把3个评价指标的文件中,super初始化里的compute_on_step关键字去掉就可以

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

6 participants