Skip to content

Commit b71999b

Browse files
Add halo to values for embedding caching
1 parent a1ce544 commit b71999b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

micro_sam/util.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,14 +490,18 @@ def precompute_image_embeddings(
490490
data_signature = _compute_data_signature(input_)
491491

492492
f = zarr.open(save_path, "a")
493-
key_vals = [("data_signature", data_signature),
494-
("tile_shape", tile_shape), ("model_type", predictor.model_type)]
493+
key_vals = [
494+
("data_signature", data_signature),
495+
("tile_shape", tile_shape if tile_shape is None else list(tile_shape)),
496+
("halo", halo if halo is None else list(halo)),
497+
("model_type", predictor.model_type)
498+
]
495499
for key, val in key_vals:
496500
if "input_size" in f.attrs: # we have computed the embeddings already
497501
# key signature does not match or is not in the file
498502
if key not in f.attrs or f.attrs[key] != val:
499503
warnings.warn(
500-
f"Embeddings file {save_path} is invalid due to unmatching {key}."
504+
f"Embeddings file {save_path} is invalid due to unmatching {key}. "
501505
"Please recompute embeddings in a new file."
502506
)
503507
if wrong_file_callback is not None:

0 commit comments

Comments
 (0)