[Bug]: Model download sleeps after its final failed attempt

オープン
#855 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@elysiopires がすでに取り組んでいます。

2026年10月29日 から。

  • #856 @elysiopires による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
3.3k
フォーク
289
平均マージ
3日 13時間
マージ済み PR(30日)
58

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

qdrant/fastembed のほかの issue

qdrant/fastembed の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。