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

save ETag metadata, add allowOffline #90

Merged
merged 2 commits into from
Jul 10, 2024
Merged

save ETag metadata, add allowOffline #90

merged 2 commits into from
Jul 10, 2024

Conversation

ngxson
Copy link
Owner

@ngxson ngxson commented Jul 8, 2024

Add allowOffline as an option for loadModelFromUrl. If model is in cache and fetch request fails (for any reasons), then we fallback to cached model file:

await wllama.loadModelFromUrl(MODEL, {
  allowOffline: true,
}

This should work without relying on Navigator.onLine


A method is also added to retrieve data for cached file:

await wllama.cacheManager.getMetadata(url); // null if file not in cache
// or, list all files with metadata
await wllama.cacheManager.list();

@ngxson ngxson linked an issue Jul 8, 2024 that may be closed by this pull request
@ngxson ngxson merged commit 8bf1b80 into master Jul 10, 2024
2 checks passed
@nfplay
Copy link

nfplay commented Nov 24, 2024

Hi, this works on desktop if network is not present, but i'm not getting the same experience on mobile in airplane mode for instance. Are you able to reproduce the same behaviour on mobile?

Thanks,
Nuno

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.

Model caching with new download manager?
2 participants