From b78972c665fbe86603f8368d87cc718d5410eb3d Mon Sep 17 00:00:00 2001 From: David Corvoysier Date: Tue, 16 Jan 2024 09:23:05 +0000 Subject: [PATCH] feat(cache): add warning on cache miss --- optimum/neuron/utils/hub_neuronx_cache.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/optimum/neuron/utils/hub_neuronx_cache.py b/optimum/neuron/utils/hub_neuronx_cache.py index d8def856d..1a4c539f4 100644 --- a/optimum/neuron/utils/hub_neuronx_cache.py +++ b/optimum/neuron/utils/hub_neuronx_cache.py @@ -125,7 +125,14 @@ def exists(self, path): # Always prioritize the default cache if self.default_cache.exists(path): return True - return self.api.file_exists(self.repo_id, self._rel_path(path)) + rel_path = self._rel_path(path) + exists = self.api.file_exists(self.repo_id, rel_path) + if not exists: + logger.warning( + f"{rel_path} not found in {self.repo_id}: the corresponding graph will be recompiled." + " This may take up to one hour for large models." + ) + return exists def download_file(self, filename, dst_path): # Always prioritize the default cache for faster retrieval