From 95d60df4dd78a56c1889c2f89b5854bdf8e14844 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Fri, 29 Jan 2021 12:00:27 +0100 Subject: [PATCH] avoid KeyError (review mdouze) --- faiss/python/loader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/faiss/python/loader.py b/faiss/python/loader.py index 469d6f527d..e591575fab 100644 --- a/faiss/python/loader.py +++ b/faiss/python/loader.py @@ -43,7 +43,10 @@ def instruction_set(): logger = logging.getLogger(__name__) try: - has_AVX2 = instruction_set()["AVX2"] # dict-values of instruction_set() are True or False + instr_set = instruction_set() + # dict-values of instr_set are True or False, but do not have + # uniform keys across arches -> use fallback value of False + has_AVX2 = instr_set.get("AVX2", False) if has_AVX2: logger.info("Loading faiss with AVX2 support.") from .swigfaiss_avx2 import *