Deduplicate by model ID
This commit is contained in:
@@ -129,8 +129,9 @@ class TestStartDownloadAutoEviction:
|
||||
|
||||
# MODEL_A (oldest) should have been evicted
|
||||
mock_delete.assert_called_once_with(MODEL_A)
|
||||
assert isinstance(coordinator.download_status[MODEL_A], DownloadEvicted)
|
||||
assert coordinator.download_status[MODEL_A].evicted_for == MODEL_NEW
|
||||
evicted_status = coordinator.download_status[MODEL_A]
|
||||
assert isinstance(evicted_status, DownloadEvicted)
|
||||
assert evicted_status.evicted_for == MODEL_NEW
|
||||
|
||||
@patch(
|
||||
"exo.download.coordinator.delete_model",
|
||||
|
||||
@@ -119,18 +119,13 @@ def apply_node_download_progress(event: NodeDownloadProgress, state: State) -> S
|
||||
"""
|
||||
dp = event.download_progress
|
||||
node_id = dp.node_id
|
||||
model_id = dp.shard_metadata.model_card.model_id
|
||||
|
||||
current = list(state.downloads.get(node_id, ()))
|
||||
|
||||
replaced = False
|
||||
for i, existing_dp in enumerate(current):
|
||||
# TODO(ciaran): deduplicate by model_id for now. Will need to use
|
||||
# shard_metadata again when pipeline and tensor downloads differ.
|
||||
# For now this is fine
|
||||
if (
|
||||
existing_dp.shard_metadata.model_card.model_id
|
||||
== dp.shard_metadata.model_card.model_id
|
||||
):
|
||||
if existing_dp.shard_metadata.model_card.model_id == model_id:
|
||||
current[i] = dp
|
||||
replaced = True
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user