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 78be19d6..70f7ecf6 100644 Binary files a/tests/fixtures/arrays.npz and b/tests/fixtures/arrays.npz differ 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)