Skip to content
This repository was archived by the owner on Apr 10, 2024. It is now read-only.

Commit b24b223

Browse files
author
Ludwig Schubert
committed
Minor cleanups preparing for a patch releaase
1 parent 1429c37 commit b24b223

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

lucid/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@
2424

2525
logging.basicConfig(level=logging.WARN)
2626
del logging
27+
28+
# Lucid uses a fixed random seed for reproducability. Use to seed sources of randomness.
29+
seed = 0

lucid/misc/io/saving.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,16 @@ def save_txt(object, handle, **kwargs):
8787
handle.write(object)
8888
elif isinstance(object, list):
8989
for line in object:
90-
if not isinstance(line, str):
91-
line = repr(line)
90+
if isinstance(line, str):
91+
line = line.encode()
92+
if not isinstance(line, bytes):
93+
line_type = type(line)
94+
line = repr(line).encode()
9295
warnings.warn(
93-
"`save_txt` was called with an array containing objects other than "
94-
"strings; using `repr` to convert values to string."
96+
"`save_txt` found an object of type {}; using `repr` to convert it to string.".format(line_type)
9597
)
96-
if not line.endswith("\n"):
97-
line += "\n"
98+
if not line.endswith(b"\n"):
99+
line += b"\n"
98100
handle.write(line)
99101

100102

lucid/modelzoo/aligned_activations.py

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
# limitations under the License.
1414
# ==============================================================================
1515

16+
"""Helper code for downloading and using previously collected aligned activations.
17+
See recipes > collection for code that collected them in teh first place."""
18+
1619
from __future__ import absolute_import, division, print_function
1720

1821
from lucid.misc.io.sanitizing import sanitize

lucid/modelzoo/other_models/InceptionV1.py

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class InceptionV1(Model):
5959
def post_import(self, scope):
6060
_populate_inception_bottlenecks(scope)
6161

62+
6263
InceptionV1.layers = _layers_from_list_of_dicts(InceptionV1, [
6364
{'tags': ['conv'], 'name': 'conv2d0', 'depth': 64},
6465
{'tags': ['conv'], 'name': 'conv2d1', 'depth': 64},

tests/fixtures/multiline-array.txt

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Line 0
2+
Line 1
3+
Line 2
4+
Line 3
5+
Line 4
6+
Line 5
7+
Line 6
8+
Line 7
9+
Line 8
10+
Line 9

0 commit comments

Comments
 (0)