geomloss icon indicating copy to clipboard operation
geomloss copied to clipboard

ValueError: Maximum allowed size exceeded

Open bit0123 opened this issue 4 years ago • 5 comments

I am trying to computer Sinkhorn distance between two tensor of size 2x256. My data are quite sparse. I got the folowing error:

File "/usr/local/lib/python3.6/dist-packages/geomloss/sinkhorn_samples.py", line 48, in sinkhorn_tensorized diameter, ε, ε_s, ρ = scaling_parameters( x, y, p, blur, reach, diameter, scaling ) File "/usr/local/lib/python3.6/dist-packages/geomloss/sinkhorn_divergence.py", line 72, in scaling_parameters ε_s = epsilon_schedule( p, diameter, blur, scaling ) File "/usr/local/lib/python3.6/dist-packages/geomloss/sinkhorn_divergence.py", line 61, in epsilon_schedule + [ blur**p ] ValueError: Maximum allowed size exceeded Why this is happening and how can i solve this? Any help is highly appreciated. Thanks

bit0123 avatar Jul 27 '20 01:07 bit0123

I had the same issue, the scaling you're using is too close to 1. @jeanfeydy I fixed it locally by using a generator. Do you want me to send a PR for that?

AdrienCorenflos avatar Jul 27 '20 07:07 AdrienCorenflos

PR would be great. Thanks

bit0123 avatar Jul 27 '20 07:07 bit0123

Jean will correct me if I'm mistaken, but the real fix for you is to lower your scaling parameter I'd presume, except if you know you really, really can't do without this precision (also if you have put a scaling of 1 you will still end up having an infinite loop anyway, even with my PR)

AdrienCorenflos avatar Jul 27 '20 07:07 AdrienCorenflos

Hi there, I met the same question frequently. It seems the list of values created by np.arange is too long. So I tried with small scaling parameter (1e-3) but it came a again. So I wonder how can I do to fix or avoid this error? Thank u!

AEGISEDGE avatar Apr 01 '21 01:04 AEGISEDGE

For me it was the estimated diameter parameter becoming too large because of instable training. I looked at the magnitude of my samples and set the parameter myself.

A-Vzer avatar Aug 28 '21 23:08 A-Vzer