Closed TboneZheng closed 11 months ago
My colleague also had this kind of weird issue, but we were not able to reproduce it consistently. Do you have code that you can share and that runs into this issue consistently?
Thanks for getting back to me.
Unfortunately, I cannot consistently reproduce either. Sometimes it happens sometimes it does not. I'm running pymoo as part of a larger python program and so it would not be useful to share the whole thing.
Seems strange to me that progress can be less than zero.
Best
Tony
From: Cyril Picard @.> Sent: Tuesday, 9 May 2023, 14:30 To: anyoptimization/pymoo @.> Cc: TboneZheng @.>; Author @.> Subject: Re: [anyoptimization/pymoo] Assertion error related to termination criteria (Issue #427)
My colleague also had this kind of weird issue, but we were not able to reproduce it consistently. Do you have code that you can share and that runs into this issue consistently?
— Reply to this email directly, view it on GitHubhttps://github.com/anyoptimization/pymoo/issues/427#issuecomment-1540130680, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A5HXADV5FKSTABXMYMFPHL3XFJBIFANCNFSM6AAAAAAX3GTTHI. You are receiving this because you authored the thread.Message ID: @.***>
I’ve done some investigating and this is what I’ve uncovered: Before the error I get the following warnings:
pymoo/algorithms/moo/nsga2.py:175: RuntimeWarning: invalid value encountered in subtract dist = np.row_stack([_F, np.full(n_obj, np.inf)]) - np.row_stack([np.full(n_obj, -np.inf), _F])
pymoo/algorithms/moo/nsga2.py:183: RuntimeWarning: invalid value encountered in divide dist_to_last, dist_to_next = dist_to_last[:-1] / norm, dist_to_next[1:] / norm
pymoo/termination/ftol.py:14: RuntimeWarning: invalid value encountered in subtract return np.max(np.abs((a - b) / norm))
pymoo/util/normalization.py:86: RuntimeWarning: invalid value encountered in subtract N[..., neither_nan] = (X[..., neither_nan] - xl[neither_nan]) / (xu[neither_nan] - xl[neither_nan])
pymoo/util/normalization.py:86: RuntimeWarning: invalid value encountered in divide N[..., neither_nan] = (X[..., neither_nan] - xl[neither_nan]) / (xu[neither_nan] - xl[neither_nan])
I also added a print statement in termination.py:
if self.force_termination:
progress = 1.0
else:
progress = self._update(algorithm)
ic(progress)
assert progress >= 0.0
This shows that progress is ‘nan’ when the assertion fails.
Does this help uncover anything?
Best
Tony
From: 正 唐 @.> Sent: Tuesday, May 9, 2023 2:45:51 PM To: anyoptimization/pymoo @.>; anyoptimization/pymoo @.> Cc: Author @.> Subject: Re: [anyoptimization/pymoo] Assertion error related to termination criteria (Issue #427)
Thanks for getting back to me.
Unfortunately, I cannot consistently reproduce either. Sometimes it happens sometimes it does not. I'm running pymoo as part of a larger python program and so it would not be useful to share the whole thing.
Seems strange to me that progress can be less than zero.
Best
Tony
From: Cyril Picard @.> Sent: Tuesday, 9 May 2023, 14:30 To: anyoptimization/pymoo @.> Cc: TboneZheng @.>; Author @.> Subject: Re: [anyoptimization/pymoo] Assertion error related to termination criteria (Issue #427)
My colleague also had this kind of weird issue, but we were not able to reproduce it consistently. Do you have code that you can share and that runs into this issue consistently?
— Reply to this email directly, view it on GitHubhttps://github.com/anyoptimization/pymoo/issues/427#issuecomment-1540130680, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A5HXADV5FKSTABXMYMFPHL3XFJBIFANCNFSM6AAAAAAX3GTTHI. You are receiving this because you authored the thread.Message ID: @.***>
It looks like a problem with normalization. If you come across it again, it would be great if you can create a code snippet to reproduce it. Otherwise, it will be hard for us to fix it.
Hi,
My colleague has managed to create a script that reproduces the issue. He has also provided a .yml file to replicate his conda enviroment. But he is using a mac. Just incase that fails here are the packages and their version that are needed:
To run the code, simply run all cells in the notebook
scikit-learn==1.2.2 torch==2.0.0 gpytorch==1.10 pymoo==0.6.0.1
Look forward to getting this fixed :)
From: Julian Blank @.> Date: Thursday, 11 May 2023 at 04:00 To: anyoptimization/pymoo @.> Cc: TboneZheng @.>, Author @.> Subject: Re: [anyoptimization/pymoo] Assertion error related to termination criteria (Issue #427)
It looks like a problem with normalization. If you come across it again, it would be great if you can create a code snippet to reproduce it. Otherwise, it will be hard for us to fix it.
— Reply to this email directly, view it on GitHubhttps://github.com/anyoptimization/pymoo/issues/427#issuecomment-1543260704, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A5HXADSCTNDMAMSZTK57FNDXFRI5NANCNFSM6AAAAAAX3GTTHI. You are receiving this because you authored the thread.Message ID: @.***>
Hi Julian,
Did you manage to run the code OK?
Best, Tony
Get Outlook for iOShttps://aka.ms/o0ukef
From: 正 唐 @.> Sent: Thursday, May 11, 2023 2:48:04 PM To: anyoptimization/pymoo @.> Subject: Re: [anyoptimization/pymoo] Assertion error related to termination criteria (Issue #427)
Hi,
My colleague has managed to create a script that reproduces the issue. He has also provided a .yml file to replicate his conda enviroment. But he is using a mac. Just incase that fails here are the packages and their version that are needed:
To run the code, simply run all cells in the notebook
scikit-learn==1.2.2
torch==2.0.0
gpytorch==1.10
pymoo==0.6.0.1
Look forward to getting this fixed :)
From: Julian Blank @.> Date: Thursday, 11 May 2023 at 04:00 To: anyoptimization/pymoo @.> Cc: TboneZheng @.>, Author @.> Subject: Re: [anyoptimization/pymoo] Assertion error related to termination criteria (Issue #427)
It looks like a problem with normalization. If you come across it again, it would be great if you can create a code snippet to reproduce it. Otherwise, it will be hard for us to fix it.
— Reply to this email directly, view it on GitHubhttps://github.com/anyoptimization/pymoo/issues/427#issuecomment-1543260704, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A5HXADSCTNDMAMSZTK57FNDXFRI5NANCNFSM6AAAAAAX3GTTHI. You are receiving this because you authored the thread.Message ID: @.***>
Sorry for the delay.
How did you upload the code? I don't think replying directly to Github Emails uploads attachments. Can. you upload it to a third-party service and post a link here?
Ah apologies, as I was replying through email I didn't realise this was going through the git discussion.
Below is the link to a temp repo where you should have everything you need including a yml file to replicate the env. Please open the test.ipynb and run all cells to replicate the bug.
https://github.com/aaronlrees/PymooBugFix
Thank you
From: Julian Blank @.> Sent: 22 May 2023 3:30 AM To: anyoptimization/pymoo @.> Cc: TboneZheng @.>; Author @.> Subject: Re: [anyoptimization/pymoo] Assertion error related to termination criteria (Issue #427)
Sorry for the delay.
How did you upload the code? I don't think replying directly to Github Emails uploads attachments. Can. you upload it to a third-party service and post a link here?
— Reply to this email directly, view it on GitHubhttps://github.com/anyoptimization/pymoo/issues/427#issuecomment-1556426609, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A5HXADRJR2MEVN2YR6DSHBTXHLFUTANCNFSM6AAAAAAX3GTTHI. You are receiving this because you authored the thread.Message ID: @.***>
Hi Julian,
Just wondering if you've managed to take a look?
Thanks
I just had a look but running into version issues when loading the model.
Traceback (most recent call last):
File "/Users/blankjul/workspace/pymoo/tests/scratch.py", line 13, in <module>
model = pickle.load(open("bugModel.p", "rb"))
AttributeError: Can't get attribute '_WrappedHook' on <module 'torch.nn.modules.module' from '/Users/blankjul/opt/anaconda3/lib/python3.9/site-packages/torch/nn/modules/module.py'>
What versions have you used to serialize the model? (torch, gpytorch, and scikit-learn)
Thanks for your reply.
Here are the versions: scikit-learn==1.2.2 torch==2.0.0 gpytorch==1.10 pymoo==0.6.0.1
Also, there is a conda .yml file in the repo that you can use to replicate the enviroment. Hopefully this resolves the issue?
Thanks
I just had a look. Next time please send an example I can directly run. Reproducing whole environments and loading models is more than looking into an issue with pymoo and takes a lot of time.
Your second objective is -inf
no matter what input you provide. Probably that should be handled somewhere and cause a warning directly. You can fix your code by
mean = rescale(np.asarray(pred.mean), self.y_scaler.scaler)
var = pred.variance.numpy() #* (self.y_scaler.std_dev**2)
I have commented out self.y_scaler.std_dev**2)
which makes it work. Your rescaling seems to cause the issue.
Hi,
I’m getting an assertion error whilst using pymoo. The error is related to the termination.
The error is: pymoo/core/termination.py", line 29, in update assert progress >= 0.0 AssertionError
Here’s how I defined the termination, and the alg that I’m using is NSGA2:
This error does not always happen. It is only sometimes… can any shed some light on possible reasons why?
I’m using pymoo 0.6.0.1
Best wishes,
Tony