The Wayback Machine - https://web.archive.org/web/20210821112833/https://github.com/infinitered/nsfwjs/issues/430
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

Comments

@morganric
Copy link

@morganric morganric commented Oct 24, 2020

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
Copy link
Member

@GantMan 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
Copy link
Member

@GantMan 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