From 2ed7d1a85d92bc019acaee2f4b942cd00f088689 Mon Sep 17 00:00:00 2001 From: cpuhrsch Date: Sat, 18 Nov 2023 14:37:32 -0800 Subject: [PATCH] Create new BEST_CONFIGS when loading wasn't possible (#73) --- segment_anything_fast/flash_4.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/segment_anything_fast/flash_4.py b/segment_anything_fast/flash_4.py index d9d0d50..2124f20 100644 --- a/segment_anything_fast/flash_4.py +++ b/segment_anything_fast/flash_4.py @@ -292,6 +292,9 @@ def _attention_rel_h_rel_w_kernel_aligned(q, k, v, rel_h_w, sm_scale): global BEST_CONFIGS if BEST_CONFIGS is None: BEST_CONFIGS = _load_best_configs() + # Loading must have not been successful. Let's create a new dictionary. + if BEST_CONFIGS is None: + BEST_CONFIGS = {} key = _create_best_configs_key(q, k, v, rel_h_w, o) if key not in BEST_CONFIGS: print("key ", key, " not found. Running autotune. This might take a while.")