From c095b851da3ed4ff2b9c1992ee87d3e9be85c70a Mon Sep 17 00:00:00 2001 From: Ludwig Schubert Date: Wed, 28 Nov 2018 20:44:15 -0800 Subject: [PATCH] Fix all remaining Python 2 incompatibilities. Ahem. --- lucid/modelzoo/aligned_activations.py | 2 +- setup.py | 3 ++- tests/fixtures/arrays.npz | Bin 3670 -> 3670 bytes tests/modelzoo/test_vision_models.py | 2 +- ...ctivation_atlas.py => activation_atlas.py} | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) rename tests/recipes/{test_activation_atlas.py => activation_atlas.py} (91%) diff --git a/lucid/modelzoo/aligned_activations.py b/lucid/modelzoo/aligned_activations.py index a2980a63..60be0005 100644 --- a/lucid/modelzoo/aligned_activations.py +++ b/lucid/modelzoo/aligned_activations.py @@ -19,7 +19,7 @@ from lucid.misc.io import load import numpy as np -from functools import lru_cache +from cachetools.func import lru_cache PATH_TEMPLATE = "gs://modelzoo/aligned-activations/{}/{}-{:05d}-of-01000.npy" PAGE_SIZE = 10000 diff --git a/setup.py b/setup.py index dea65731..48268950 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ from setuptools import setup, find_packages -version = "0.3.5" +version = "0.3.6" test_deps = ["future", "twine", "pytest", "pytest-mock", "python-coveralls"] @@ -64,6 +64,7 @@ "pyopengl", "click", "filelock", + "cachetools" ], tests_require=test_deps, extras_require=extras, diff --git a/tests/fixtures/arrays.npz b/tests/fixtures/arrays.npz index 78be19d62f5362080128a542c615ab1a6ddcdf14..70f7ecf6f061ba8e7d6a9d80362c6ac087e3ef47 100644 GIT binary patch delta 83 zcmca6b4`XXz?+#xgaHB+88-4AVP;`qP-NJAjhT%L%$odwSCWx&@-JQ~Igo@Y(;v47 UoD2*g%mvj4q8b<{8}X?C0Fhe`kpKVy delta 83 zcmca6b4`XXz?+#xgaHJ8#=Z5~$ajR91;p5VjhT%L%$odwSCX-D@-JQ~Igo@Y(;v47 UoD2*g%mvm5AsQMd8}X?C0Gpo~O#lD@ diff --git a/tests/modelzoo/test_vision_models.py b/tests/modelzoo/test_vision_models.py index 682cbab2..fa6caeb4 100644 --- a/tests/modelzoo/test_vision_models.py +++ b/tests/modelzoo/test_vision_models.py @@ -59,7 +59,7 @@ def test_model_properties(name, model_class): assert hasattr(model_class, "layers") assert len(model_class.layers) > 0 last_layer = model_class.layers[-1] - assert last_layer['type'] == 'dense' + assert 'dense' in last_layer.tags assert type(last_layer) == Layer assert last_layer.model_class == model_class assert hasattr(model_class, "name") diff --git a/tests/recipes/test_activation_atlas.py b/tests/recipes/activation_atlas.py similarity index 91% rename from tests/recipes/test_activation_atlas.py rename to tests/recipes/activation_atlas.py index 9927d4a7..4d98dc59 100644 --- a/tests/recipes/test_activation_atlas.py +++ b/tests/recipes/activation_atlas.py @@ -31,6 +31,6 @@ def test_aligned_activation_atlas(): atlasses = aligned_activation_atlas( model1, layer1, model2, layer2, number_activations=subset ) - path = f"tests/recipes/results/activation_atlas/aligned_atlas-{index}-of-{len(atlasses)}.jpg" + path = "tests/recipes/results/activation_atlas/aligned_atlas-{}-of-{}.jpg".format(index, len(atlasses)) for index, atlas in enumerate(atlasses): save(atlas, path)