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

Supporting model load from indexeddb #430

Open
morganric opened this issue Oct 24, 2020 · 2 comments
Open

Supporting model load from indexeddb #430

morganric opened this issue Oct 24, 2020 · 2 comments
Labels
Browser Issues good first issue Good for newcomers help wanted Extra attention is needed

Comments

@morganric
Copy link

if (typeof modelPathBaseOrIOHandler === "string") {

Hello, it seems, although not explicit I can save the model to different schemas by referencing the underlying "model" attribute in the model returned by nsfwjs.load() e.g.

nsfwjs.load(path).then(function (newModel) { console.log("path", path); if(newModel) { newModel.model.save('indexeddb://' + SOME_KEY); } }).catch(error => { console.error('onRejected function called: ' + error.message); })

However, I am unable to then reload the model from say an indexeddb location using:

nsfwjs.load('indexeddb://' + SOME_KEY) as the line above in the code just checks for a string, assumes it's a url or relative path, rather than another schema location and them appends 'model.js'.

I think tf.js supports loading and saving to other schemas, it'd be cool if NSFWJS followed suit ...

@GantMan GantMan added the good first issue Good for newcomers label Oct 25, 2020
@GantMan
Copy link
Member

GantMan commented Oct 25, 2020

Agreed. I think the best plan of action would be URL unless it detects something like indexeddb: or even localstorage:

Would you be interested in providing the PR with updated docs/tests/code?

@GantMan GantMan added Browser Issues help wanted Extra attention is needed labels Oct 25, 2020
@GantMan
Copy link
Member

GantMan commented Oct 25, 2020

reference for whomever provides the code: https://www.tensorflow.org/js/guide/save_load

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Browser Issues good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants