-
Notifications
You must be signed in to change notification settings - Fork 777
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
Make process_prompt Cancellable Outside Downloads #407
base: main
Are you sure you want to change the base?
Conversation
@AlexCheema PTAL, I am open to any feedback! |
I like the idea, the code is well written and the tests are extensive. However, this doesn't quite solve the problem of preventing downloads from being cancelled -- a download can be started in |
@AlexCheema Thank you for the feedback! You're absolutely right about the limitation. I see now that checking downloads only at the start of process_prompt doesn't fully protect downloads, since:
Would it be better to:
Could you guide me on which approach would be most appropriate? I can then update the PR accordingly. |
Yes I think your suggestions are good. I'm not sure I have a full solution in my head right now I'd need to look more deeply. If you want to take a look and suggest something or make more changes in this PR go ahead |
Hi @AlexCheema , I've updated the PR based on your feedback. Rather than protecting at the request level, I've moved the protection directly into HFShardDownloader where downloads happen. This ensures downloads are protected regardless of what triggers them (process_prompt or any other request). Downloads are protected where they start All tests are passing and the changes are focused just on download protection. Let me know if you'd like me to make any adjustments to this approach. If not then we can merge this PR. Thanks :) p.s - I have updated the PR description as well. |
@AlexCheema PTAL!! |
@AlexCheema PTAL! |
This PR implements protection for downloads at their source in HFShardDownloader, ensuring downloads complete regardless of request cancellation. This is a follow-up fix to #306, moving from blanket request shielding to targeted download protection.
Changes Made
HFShardDownloader.ensure_shard
to:test_hf_shard_download.py
Implementation Details
Test Coverage
Added comprehensive tests in
test_hf_shard_download.py
:test_download_protection
: Verifies downloads complete despite cancellationtest_multiple_downloads
: Ensures concurrent downloads work correctlytest_download_error_handling
: Validates proper error handlingTesting
Breaking Changes
None. This improves download protection while maintaining backward compatibility.
Checklist
Related Issues
Note to Reviewer: Per your feedback, I've moved the protection to where downloads actually happen in HFShardDownloader, rather than trying to protect at the request level. This ensures downloads complete regardless of what triggers them (process_prompt or any other request). The solution is focused and thoroughly tested.