Skip to content

feat: Only allow one Chipper call at a time - #296

Merged
awalker4 merged 6 commits into
mainfrom
austin/chipper-requests
Oct 26, 2023
Merged

awalker4 merged 6 commits into
mainfrom
austin/chipper-requests

Conversation

@awalker4

@awalker4 awalker4 commented Oct 26, 2023 •

Copy link
Copy Markdown
Collaborator

Chipper V2 is very memory hungry. While we work to optimize this, we need to restrict the server to one call at a time. While the model is in use, we'll return a 503 "Please try again". Our hosted API should scale up to meet demand, so the next call should route to an available server.

This includes a refactor to how partition_kwargs are passed to either parallel mode, local partition, or local partition with the new Chipper protection.

To verify, try calling Chipper twice:

curl -X POST 'http://localhost:8000/general/v0/general' --form files="@$file" --form strategy=hi_res --form hi_res_model_name=chipper &
curl -X POST 'http://localhost:8000/general/v0/general' --form files="@$file" --form strategy=hi_res --form hi_res_model_name=chipper

The second call will get a 503 response.

Other changes:

  • Return a 400 error if Chipper isn't loaded. The model is private, make sure we explain this for users who self host
  • Pass the huggingface token to make docker-start-api for better dev experience
  • Add a make docker-start-bash while we're in here

Chipper V2 is very memory hungry. While we work to optimize this, we need to restrict the server to
one call at a time. While the model is in use, we'll return a 503 "Please try again". Our hosted API
should scale up to meet demand, so the next call should route to an available server.

To verify, try calling Chipper twice:
```
curl -X POST 'http://localhost:8000/general/v0/general' --form files="@$file" --form strategy=hi_res
--form hi_res_model_name=chipper &
curl -X POST 'http://localhost:8000/general/v0/general' --form files="@$file" --form strategy=hi_res --form hi_res_model_name=chipper
```

The second call will get a 503 response.

@ryannikolaidis ryannikolaidis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

running locally in a container on a mac m2 (with docker resources maxed out), I'm hitting a segmentation fault while processing with chipper, but that's outside the concern of this PR. I am able to see with two concurrent requests that the first one has processing attempted while the other immediately gets a 503, which is good enough for me!

@awalker4
awalker4 merged commit c91d1b9 into main Oct 26, 2023
@awalker4
awalker4 deleted the austin/chipper-requests branch October 26, 2023 19:56
@sentry

sentry Bot commented Oct 27, 2023 •

Copy link
Copy Markdown

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ ValueError: file '<_io.BytesIO object at 0x7fa14d2c9ad0>' is not a Word file, content type is 'application/vn... /general/v0/general View Issue
  • ‼️ Server is under heavy load. Please try again later. /general/v0/general View Issue
  • ‼️ PSSyntaxError: Invalid dictionary construct: [/'BM', /'Normal', /'CA', 1, /'LC', 0, /'LJ', 0, /'LW', 2, /'ML', 4... /general/v0/general View Issue
  • ‼️ TypeError: cannot unpack non-iterable PDFObjRef object /general/v0/general View Issue
  • ‼️ PDFSyntaxError: No /Root object! - Is this really a PDF? /general/v0/general View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants