[PATCH] gnu: python-keras: Fix tests.

  • Done
  • quality assurance status badge
Details
3 participants
  • Efraim Flashner
  • Pierre Neidhardt
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Pierre Neidhardt
Severity
normal
P
P
Pierre Neidhardt wrote on 3 Mar 2020 10:22
(address . guix-patches@gnu.org)
20200303092201.7174-1-mail@ambrevar.xyz
* gnu/packages/machine-learning.scm (python-keras)[origin]: Add patch to
remove unstable selu test.
* gnu/local.mk: Include patch.
---
gnu/local.mk | 1 +
gnu/packages/machine-learning.scm | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)

Toggle diff (29 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 857345cfad..e5922aae54 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1329,6 +1329,7 @@ dist_patch_DATA = \
%D%/packages/patches/python-configobj-setuptools.patch \
%D%/packages/patches/python-faker-fix-build-32bit.patch \
%D%/packages/patches/python-keras-integration-test.patch \
+ %D%/packages/patches/python-keras-selu-test.patch \
%D%/packages/patches/python-pep8-stdlib-tokenize-compat.patch \
%D%/packages/patches/python-pyfakefs-remove-bad-test.patch \
%D%/packages/patches/python-flint-includes.patch \
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 8262a418cc..7fbdef0163 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1863,7 +1863,9 @@ with image data, text data, and sequence data.")
(origin
(method url-fetch)
(uri (pypi-uri "Keras" version))
- (patches (search-patches "python-keras-integration-test.patch"))
+ (patches
+ (search-patches "python-keras-selu-test.patch" ; Numerically unstable?
+ "python-keras-integration-test.patch"))
(sha256
(base32
"1j8bsqzh49vjdxy6l1k4iwax5vpjzniynyd041xjavdzvfii1dlh"))))
--
2.25.1
E
E
Efraim Flashner wrote on 3 Mar 2020 11:17
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)(address . 39880@debbugs.gnu.org)
20200303101703.GI6728@E5400
You forgot to add the patch :P

--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl5eLp0ACgkQQarn3Mo9
g1EShw//f7+1E3Uu7pouZUZaIX63selUYIza0f8mtPuIdS0TzrfLdjobWJ5tC7g+
b+dXN3oBEzznMojsvBxqfajU8IfylXb/PfVoEAS8+p+rr9BB1TseZgHQYM2sMmoI
DWykAUUyTM34u0VSK3DbtwluoWxW/pZKh7S5YBdkaxpPGhcg8tXqyUQvUgjIzVCD
zfmXKuG7xrkp1hBtZ1h4gW1wLAU0kSxXdrQH30QtYl5mLz92l6pTGfGM28u3CcUB
Eja9UJkPOQaJg9+i68g7Jkzj7ADa/SMjThl/tASPPkesYiE8I/UkUPvMOmJI+AyX
g5+pR9wCKqzPnKUhStal7wCF99w0obVx/KRuZKv+zssmfEsDmcbAZ+O87Y2fZ02d
pSnwtqR3bCBFtQY9RWGt3o9cbzQevGy9fKKX2vxzXLUfDv5CgCiD6+CUnjVLW69K
+XkR3fthfJV1GjNurd7IEW2W1KhA8J4Dm5L/B5BUqeipWbFNtkrtG0T2m5m1/JEo
hY+PAKh2nWEGGiV2dqmFgIXiTxGzxKJ2pxajZDQrsFIIJLBa+fI6Xws3hY8neUy5
bwV9qD6N1WGEw480fCCo+xh4g2phBcLx4VLgvgH0JhEQUFWCLjjSTaa7LEnIbLW/
uVgJ3HN8UoFjArhk9q4yTqHXpS64eyCMxi404rdByVznBwgUzNs=
=UcI9
-----END PGP SIGNATURE-----


P
P
Pierre Neidhardt wrote on 3 Mar 2020 11:38
[PATCHv2] gnu: python-keras: Fix tests.
(address . 39880@debbugs.gnu.org)
20200303103809.18233-1-mail@ambrevar.xyz
* gnu/packages/machine-learning.scm (python-keras)[origin]: Add patch to
remove unstable selu test.
* gnu/local.mk: Include patch.
* gnu/packages/patches/python-keras-selu-test.patch: New file.
---
gnu/local.mk | 1 +
gnu/packages/machine-learning.scm | 4 ++-
.../patches/python-keras-selu-test.patch | 35 +++++++++++++++++++
3 files changed, 39 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/python-keras-selu-test.patch

Toggle diff (70 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 857345cfad..e5922aae54 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1329,6 +1329,7 @@ dist_patch_DATA = \
%D%/packages/patches/python-configobj-setuptools.patch \
%D%/packages/patches/python-faker-fix-build-32bit.patch \
%D%/packages/patches/python-keras-integration-test.patch \
+ %D%/packages/patches/python-keras-selu-test.patch \
%D%/packages/patches/python-pep8-stdlib-tokenize-compat.patch \
%D%/packages/patches/python-pyfakefs-remove-bad-test.patch \
%D%/packages/patches/python-flint-includes.patch \
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 8262a418cc..7fbdef0163 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1863,7 +1863,9 @@ with image data, text data, and sequence data.")
(origin
(method url-fetch)
(uri (pypi-uri "Keras" version))
- (patches (search-patches "python-keras-integration-test.patch"))
+ (patches
+ (search-patches "python-keras-selu-test.patch" ; Numerically unstable?
+ "python-keras-integration-test.patch"))
(sha256
(base32
"1j8bsqzh49vjdxy6l1k4iwax5vpjzniynyd041xjavdzvfii1dlh"))))
diff --git a/gnu/packages/patches/python-keras-selu-test.patch b/gnu/packages/patches/python-keras-selu-test.patch
new file mode 100644
index 0000000000..68092d2593
--- /dev/null
+++ b/gnu/packages/patches/python-keras-selu-test.patch
@@ -0,0 +1,35 @@
+Disable unstable SELU test.
+See https://github.com/keras-team/keras/issues/13856.
+
+diff --git a/tests/keras/activations_test.py b/tests/keras/activations_test.py
+index 4c0bb36..5808c0f 100644
+--- a/tests/keras/activations_test.py
++++ b/tests/keras/activations_test.py
+@@ -208,24 +208,6 @@ def test_elu():
+ assert_allclose(result, true_result)
+
+
+-def test_selu():
+- x = K.placeholder(ndim=2)
+- f = K.function([x], [activations.selu(x)])
+- alpha = 1.6732632423543772848170429916717
+- scale = 1.0507009873554804934193349852946
+-
+- positive_values = get_standard_values()
+- result = f([positive_values])[0]
+- assert_allclose(result, positive_values * scale, rtol=1e-05)
+-
+- negative_values = np.array([[-1, -2]], dtype=K.floatx())
+-
+- result = f([negative_values])[0]
+- true_result = (np.exp(negative_values) - 1) * scale * alpha
+-
+- assert_allclose(result, true_result)
+-
+-
+ def test_tanh():
+ test_values = get_standard_values()
+
+--
+2.25.1
+
--
2.25.1
P
P
Pierre Neidhardt wrote on 3 Mar 2020 11:38
Re: [bug#39880] [PATCH] gnu: python-keras: Fix tests.
(name . Efraim Flashner)(address . efraim@flashner.co.il)(address . 39880@debbugs.gnu.org)
87imjl206b.fsf@ambrevar.xyz
Oops! Resent.

--
Pierre Neidhardt
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl5eM5wACgkQm9z0l6S7
zH8LtQf8CKW6J1IEsBJZfl8Tl1/grMvKkrXQWncw2BlI3aQ7ReebQhgBM2Qzg7C9
K0B457eJq4RCZVglpaYIFV+CAWA4P3IW/LpsEu7Me4JL79z7F8rrKDjbSIwWWklR
3NTa+MMuuJQzQUrMPagbH8qJ2qmXOQgRcc1tnJLFfDQOvOJGKKzVhEbyvLdSoPXo
D/dmNebvmzQR090cA3h27d+EphOKPQ/Y11zCaR5ZH9E89YZpwDhe5MtFjxzi+xpI
5pUknweCnZe4wJzLh09q56kljDul9ngIf5r8OFsB/qw3fitEXAdid0GpAly70EAO
f6iGh+ffi0J68tjzgK+qD4zRVWBouQ==
=QC2b
-----END PGP SIGNATURE-----

E
E
Efraim Flashner wrote on 3 Mar 2020 12:44
Re: [bug#39880] [PATCHv2] gnu: python-keras: Fix tests.
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)(address . 39880@debbugs.gnu.org)
20200303114452.GJ6728@E5400
I assume you've already gone for the more obvious and seen if you can
upgrade keras to 2.3.1?


--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl5eQzQACgkQQarn3Mo9
g1F3WQ//TL6Pb9uBme9jZHFCc0IsymIMuKVU3Pqg6AU1PmDFIzwYHCyGNuPO8jku
+/A9+Oj7mAHVT4sxvhrm1mCWTGP1Gi4dZfldMafvlcJH6l+S809ZP+nJZ+qPyv45
m9p1tns1ugtF2JcfIfo8TgrnSfSAMKjawyJfV4QhOeolh4+19SpUZgUPZJUQSTww
n+Sc2I+an/DdW+MtiWf7M7E2wJqdODaPYO36BOOld7x7WRnwScrFNEDaRenb6t4/
Y1VWPeFpos1yxg8RQpFMZVuzm/k2jxdJr8v36RiZLfUqrPZ0DUhcwJWiLth+t0oU
cwgKwPUNaccOMdRUvZaviDWn3knCkSdL3BkV1av44yYUb8V49IlfwGQtJ8CLcXDZ
VltajkbI5pekM2rVe8bJ4RoJzmoAHCqsHmZ0otcgDwo8TpGTxKUTZ7y45CIwHAb4
04/5wbMtTZ1Bm5VNSHjpM2rCOTRgRo2/KlkRnfZ9oFgzWtFB7y2HY8N3StmAwAL3
CcbSrDa2jdsxn+/taEg3jtyOhWPX9DB/s2cFZJBbG5H2+U3KTEnMvEw1VA2kXBJb
nt0KvejaI/F1/MwsZaHfVcxYcsfNfNf99s9kWD/F0ZIdV2j8F1xzswkpP3igoQzG
Cr/DuzAZliHxZAoAYgHxHSA7vJ7jt8y3asD4CG5uEFTRsqiN0K4=
=P83z
-----END PGP SIGNATURE-----


P
P
Pierre Neidhardt wrote on 3 Mar 2020 12:56
(name . Efraim Flashner)(address . efraim@flashner.co.il)(address . 39880@debbugs.gnu.org)
871rq9fy8t.fsf@ambrevar.xyz
Indeed :)

Starting from Keras 2.2.5, the other backends are unconditionally
required by the tests, so it won't do :(

Not sure what to do about it. In all cases, it's a a lot of work, so I
figured we'd rather get 2.2.4 to build at least.

--
Pierre Neidhardt
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl5eReIACgkQm9z0l6S7
zH+XWQf9Em6xs2UFX0rn59uR9+NSA2U7ZJLDvXuc1WbwHmmR/WsC/sgNaZEPGxTV
Zvu6DopXUo+zTRDA2GTmnB59RM4hR9SVA+WaFfTd/8/GUouHrvqeVy5wgzI3nWTe
K0qXllu0FgIKfJK0hRD9Y4IdrGHERL6i4afQ3XP/+xiPikJTboGTTFFMpLz1e5lL
3nchGD2rc4b8CX4x03Zy+AU/zuWnUe3wCnfpB+RyZKR1bZfHuvUMebnv6MiEbDC2
GB4DBaXjV8fIcro5PDjSPmzHQ0PEQGdDr7RfC+wCUkrdDPbo8b4AtFEJfx1u4dB0
DW/Hcoml14npZ+yrfRuTCVoKP6WHsg==
=4kgv
-----END PGP SIGNATURE-----

M
M
Maxim Cournoyer wrote on 5 Oct 2020 07:53
control message for bug #39880
(address . control@debbugs.gnu.org)
87h7r9jk0p.fsf@gmail.com
tags 39880 fixed
close 39880
quit
?