[Bug]: Model download sleeps after its final failed attempt
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
The issue identifies ModelManagement.download_model() in fastembed/common/model_management.py and describes mocked regression cases for one and three attempts, with and without URL fallback. Read the retry and sleep logic, then run the regression cases described in the issue. Done means sleeps occur only between attempts while the attempt count, URL fallback, offline behavior, and final exception remain unchanged.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happened?
ModelManagement.download_model() sleeps after the final failed download attempt, even when its retry counter has reached zero.
With the default retries=3, failed downloads sleep for 3, 9 and 27 seconds. Only the first two sleeps precede another attempt; the last 27 seconds delay the final ValueError without retrying anything. With retries=1, a failed attempt still sleeps for three seconds before returning the error.
Minimal reproduction
This reproducer mocks model downloads and sleep, so it needs no model weights or network access:
from unittest.mock import Mock, patch
from fastembed.common.model_description import BaseModelDescription, ModelSource
from fastembed.common.model_management import ModelManagement
model = BaseModelDescription(
model="test/missing-model",
sources=ModelSource(hf="test/missing-model"),
model_file="model.onnx",
description="Test fixture",
license="Apache-2.0",
size_in_GB=0.0,
)
with patch.object(ModelManagement, "download_files_from_huggingface", side_effect=OSError("unavailable")), patch("fastembed.common.model_management.time.sleep") as sleep:
try:
ModelManagement.download_model(model, "/tmp/unused-fastembed-repro", retries=3)
except ValueError:
pass
print(sleep.call_args_list)
Actual: [call(3.0), call(9.0), call(27.0)]
Expected: [call(3.0), call(9.0)]
Run with HF_HUB_OFFLINE unset.
Proposed fix
Sleep only when another attempt remains. Preserve the number of attempts, exponential delays between them, URL fallback, offline behavior and the final exception.
I reproduced this with four regression cases covering one/three attempts, with and without URL fallback. All four fail before the fix because of the extra sleep.
Environment
- FastEmbed 0.9.1 from current main
- Python 3.11.9 on macOS
- Downloads and sleeps mocked; no model downloaded or credentials used
AI assistance: OpenAI Codex. The regression cases were run locally.
- Ngôn ngữ chính
- Python
- Star
- 3.3k
- Fork
- 289
- Merge trung bình
- 3 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 58
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của qdrant/fastembed
-
Weekly tests failedCó thể đã có người làm @joein đã nhận 7 ngày trước. Đang mở
qdrant/fastembed#843 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: rerank_pairs raises TypeError when pairs are passed as a tuple of pairsCó thể đã có người làm @michaelkillgta đã nhận 24 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 22/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Feature]: Support huggingface-hub 2.0Có thể làm lại được @joein đã nhận 34 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
qdrant/fastembed#742 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Silent all-NaN embeddings when a model file is incompatible with the runtime (0.8.0 still ships the fp16 jina-de model fixed by #623)Có thể đã có người làm @Shikhaar đã nhận 68 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
qdrant/fastembed#688 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Resolving License IssuesĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
qdrant/fastembed#679 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của qdrant/fastembed
Issue tương tự
-
area:scripts area:tests bug priority:later
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Ikalus1988/MisakaNet#4358 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Discovered ports from service discovery are never propagated to modules in Module.load()Có thể đã có người làm @vishalmore90 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
OWASP/Nettacker#1828 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
aws-samples/sample-per-model-bedrock#708 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
[Performance] Bound resolve_api_hashes raw fallback reads to the 1 MiB region actually scannedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
sjkim1127/Reversecore_MCP#365 ·
Maintainer thường phản hồi trong vòng 1 ngày