-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
feat: exposing deno_cache
+ ai cache interceptor
#446
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kallebysantos
force-pushed
the
feat-cache-api
branch
from
November 20, 2024 00:09
c65261e
to
370b075
Compare
nyannyacha
force-pushed
the
feat-cache-api
branch
from
November 21, 2024 04:26
6a0e6cd
to
5ae3ba3
Compare
laktek
reviewed
Nov 22, 2024
nyannyacha
force-pushed
the
feat-cache-api
branch
2 times, most recently
from
November 23, 2024 01:17
aa91f49
to
1f5024b
Compare
kallebysantos
force-pushed
the
feat-cache-api
branch
2 times, most recently
from
November 23, 2024 12:08
3e81242
to
e9b2f50
Compare
**NOTE:** saving cache in `temp folder` consider move it to a better location
- adding a cache adapter that intercepts `transformers-cache` - fetch and caching models from rust land
- using a separated file to store `ort` predictions snapshots for both `x64` and `arm64`.
- Checking for `RUST_LOG` env, then executing tests as `debug` with tracing enabled
- Applying url check to prevent request errors, matching between `Url` and `Model Bytes`.
- Adding tests scenarios for `env.useBrowserCache = true`
- blocking `Web Cache API` to only allow caching of `.onnx` files comming from `transformers.js` lib.
kallebysantos
force-pushed
the
feat-cache-api
branch
from
November 23, 2024 12:17
e9b2f50
to
8f9a535
Compare
nyannyacha
force-pushed
the
feat-cache-api
branch
from
November 23, 2024 13:20
8f9a535
to
7bc241a
Compare
laktek
approved these changes
Nov 24, 2024
@kallebysantos @nyannyacha Thanks for these changes! Merging this PR (I will run some performance tests in our staging environment before rolling this out) |
🎉 This PR is included in version 1.64.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This was referenced Nov 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
feature, enhancement
What is the current behavior?
When using huggingface/transformers.js the model assets can't be cached. It means that each
worker
life cycle will require a new fetch of these assets.What is the new behavior?
The
deno_cache
is now exposed to Js land, so thattransformers.js
lib can use the globalcaches
object to store model assets. Also an interceptor has been attached todeno_cache
, with this we can interpect only.onnx
requests and use it during session load.How it works?
By attaching an interceptor, we can filter by
.onnx
requests and return back theurl bytes
instead of fetching the model. This waytransformers.js
lib will think that its ownmodel's bytes
and use it during session init.The exposed
onnx
runtime will knows when the incoming bytes is eitherurl string
ormodel bytes
this way it can choose to load from internal cache or memory.When loading from internal cache its achieve almost the same behaviour of PR #368 (Pipeline RFC)
Final considerations:
This is an adapted work from #368 where we spitted out only the core features that improves ort support for
edge-runtime
.Finally, thanks for @nyannyacha that help me with this proposal and code as well 🙏