harmonydata / harmonydata/harmonyapi
Warning about fork and HuggingFace
- 主要言語
- Python
- スター
- 2
- フォーク
- 16
- 平均マージ
- 1分
- マージ済み PR(30日)
- 1
説明
## Description
When I run the API on Docker I get this warning in the logs:
```
INFO: 172.17.0.1:57538 - "POST /text/match HTTP/1.1" 422 Unprocessable Entity
INFO: 172.17.0.1:57554 - "POST /text/match HTTP/1.1" 200 OK
INFO: 172.17.0.1:57562 - "POST /text/match HTTP/1.1" 200 OK
INFO: 172.17.0.1:54830 - "POST /text/match HTTP/1.1" 200 OK
INFO: 172.17.0.1:54834 - "POST /text/match HTTP/1.1" 200 OK
INFO: 172.17.0.1:54844 - "POST /text/match?is_negate=false HTTP/1.1" 200 OK
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
2025-01-25 16:31:09,257 [AnyIO worker] [WARNI] Failed to see startup log message; retrying...
Preparing data for Tika
```
maybe it's nothing to worry about. I guess we can fix it by setting `TOKENIZERS_PARALLELISM` but I want to confirm that this is not doing any harm first. Needs some investigation.
I suspect we might be instantiating multiple instances of the HuggingFace transformers. If an LLM exists multiple times in RAM we need to stop that happening because they are already memory hungry.
## Environment
Docker
## How to Reproduce
1. Check out the repo
2. `export COMMIT_ID=`git show -s --format=%ci_%h | sed s/[^_a-z0-9]//g | sed s/0[012]00_/_/g` && docker build -t harmonyapi -t harmonyapi:$COMMIT_ID -t harmonydata/harmonyapi -t harmonydata/harmonyapi:$COMMIT_ID --build-arg COMMIT_ID=$COMMIT_ID .`
3. `docker run -p 8000:80 harmonydata/harmonyapi:$COMMIT_ID`
## Expected Behaviour
Ideally we would not get this error.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
ドキュメント化された Docker のビルドおよび実行コマンドで警告を再現し、/text/match API と起動メッセージに注意してください。HuggingFace transformers の初期化と fork の境界を追跡し、複数のモデルインスタンスが作成されるかどうかも確認してください。警告が害やモデルの重複を引き起こすかどうかを文書化し、必要に応じて検証済みの安全な設定またはコード変更を適用できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- docker, huggingface, python
- 領域
- ai, api, backend, devops
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100