Skip to content

Commit f8751af

Browse files
RkGritCRZbulabula
authored andcommitted
If model is already ACTIVATING or ACTIVE, skip duplicate update and download (#16868)
1 parent 381aea8 commit f8751af

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

iotdb-core/ainode/iotdb/ainode/core/model/model_storage.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ def _process_builtin_model_directory(self, model_dir: str, model_id: str):
123123
"""Handling the discovery logic for a builtin model directory."""
124124
ensure_init_file(model_dir)
125125
with self._lock_pool.get_lock(model_id).write_lock():
126+
# Check if model already exists and is in a valid state
127+
existing_model = self._models[ModelCategory.BUILTIN.value].get(model_id)
128+
if existing_model:
129+
# If model is already ACTIVATING or ACTIVE, skip duplicate download
130+
if existing_model.state in (ModelStates.ACTIVATING, ModelStates.ACTIVE):
131+
return
132+
133+
# If model not exists or is INACTIVE, we'll try to update its info and download its weights
126134
self._models[ModelCategory.BUILTIN.value][model_id] = (
127135
BUILTIN_HF_TRANSFORMERS_MODEL_MAP[model_id]
128136
)

0 commit comments

Comments
 (0)