Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AsyncInferenceClient uses synchronous time.sleep #2672

Closed
james-deee opened this issue Nov 21, 2024 · 2 comments · Fixed by #2674
Closed

AsyncInferenceClient uses synchronous time.sleep #2672

james-deee opened this issue Nov 21, 2024 · 2 comments · Fixed by #2674
Labels
bug Something isn't working

Comments

@james-deee
Copy link

Describe the bug

We have a highly concurrent environemnt using the async event loop and noticed that everything would get locked up. All of your code was using async, so we went looking in the asyncinferenceclient to see what it did when an inference endpoint wasn't ready......

https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/inference/_generated/_async_client.py#L327

Unfortunately that blocks everything on the event loop. This should instead be:
await asyncio.sleep(1)

Reproduction

No response

Logs

No response

System info

- huggingface_hub version: 0.26.2
- Platform: macOS-14.4.1-arm64-arm-64bit
- Python version: 3.11.7
- Running in iPython ?: No
- Running in notebook ?: No
- Running in Google Colab ?: No
- Running in Google Colab Enterprise ?: No
- Token path ?: /Users/jd/.cache/huggingface/token
- Has saved token ?: True
- Who am I ?: jamie-de
- Configured git credential helpers: osxkeychain
- FastAI: N/A
- Tensorflow: N/A
- Torch: 2.2.0
- Jinja2: 3.1.4
- Graphviz: N/A
- keras: N/A
- Pydot: N/A
- Pillow: 11.0.0
- hf_transfer: N/A
- gradio: N/A
- tensorboard: N/A
- numpy: 1.25.1
- pydantic: 2.9.2
- aiohttp: 3.10.11
- ENDPOINT: https://huggingface.co
- HF_HUB_CACHE: /Users/jd/.cache/huggingface/hub
- HF_ASSETS_CACHE: /Users/jd/.cache/huggingface/assets
- HF_TOKEN_PATH: /Users/jd/.cache/huggingface/token
- HF_STORED_TOKENS_PATH: /Users/jd/.cache/huggingface/stored_tokens
- HF_HUB_OFFLINE: False
- HF_HUB_DISABLE_TELEMETRY: False
- HF_HUB_DISABLE_PROGRESS_BARS: None
- HF_HUB_DISABLE_SYMLINKS_WARNING: False
- HF_HUB_DISABLE_EXPERIMENTAL_WARNING: False
- HF_HUB_DISABLE_IMPLICIT_TOKEN: False
- HF_HUB_ENABLE_HF_TRANSFER: False
- HF_HUB_ETAG_TIMEOUT: 10
- HF_HUB_DOWNLOAD_TIMEOUT: 10
@Wauplin
Copy link
Contributor

Wauplin commented Nov 22, 2024

Hi @james-deee , thanks for noticing. This is clearly an oversight from our side while implementing the AsyncInferenceClient. I've opened a PR to fix it: #2674

@james-deee
Copy link
Author

Thanks! Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants