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

realDivide missing in tfjs-node #12

Closed
danwexler opened this issue Jan 21, 2021 · 5 comments
Closed

realDivide missing in tfjs-node #12

danwexler opened this issue Jan 21, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@danwexler
Copy link
Contributor

danwexler commented Jan 21, 2021

The tf.div in models/idealo-gans.js fails when running using tfjs-node on Ubuntu. I get the following error:

'realDivide' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen

I do NOT see this error running using the CPU backend on OSX. Everything works fine. On Ubuntu it fails. I've tested this using the 1.15.5 tensorflow gpu installation with both the latest tfjs-node-gpu@2.8.5 and with the earlier version that matches the upscaler package.json, tfjs-node-gpu@2.1.0. I have not yet dug into the TFJS or TF side of things to find the bug.

A simple workaround is:

--- a/node_modules/upscaler/dist/models/idealo-gans.js
+++ b/node_modules/upscaler/dist/models/idealo-gans.js
@@ -38,7 +38,7 @@ PixelShuffle.className = 'PixelShuffle';
 const config = {
     urlPath: 'idealo/gans',
     scale: 4,
-    preprocess: (image) => tf.div(image, 255),
+    preprocess: (image) => tf.mul(image, 1 / 255),
     postprocess: (output) => tf.mul(output.clipByValue(0, 1), 255),
     customLayers: [MultiplyBeta, PixelShuffle],
 };
@thekevinscott
Copy link
Owner

This is a great find (and sorry for the delay in response, @danwexler ). Would you be open to making this a PR?

@danwexler
Copy link
Contributor Author

Yep. Will do. FYI, I have found a number of memory leaks in the code as well, which are particularly visible when running in Node on a GPU. I'll try to make a separate PR for those fixes as well.

@thekevinscott
Copy link
Owner

Awesome, looking forward to it!

If you haven't started yet, make sure to pull master. I pushed a refactor that moves code into packages/upscalerjs, so that I was able to import the models from https://github.com/thekevinscott/UpscalerJS-models into this repo.

@stale
Copy link

stale bot commented May 14, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label May 14, 2021
@stale stale bot closed this as completed May 21, 2021
@thekevinscott thekevinscott reopened this Nov 9, 2021
@thekevinscott thekevinscott added bug Something isn't working and removed wontfix This will not be worked on labels Nov 9, 2021
@thekevinscott
Copy link
Owner

Whoops, I didn't realize this was already fixed by https://github.com/thekevinscott/UpscalerJS/pull/60/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants