keras-js
keras-js copied to clipboard
Node version doesn't work in browser
I use react-redux starter kit. I installed keras-js with npm install keras-js --save when I try to include {Model} from 'keras-js' then I get the following errors:
ERROR in ./~/keras-js/lib/Model.js Module not found: Error: Cannot resolve module 'fs' in /media/v/a218f425-0329-45ac-8571-5497bea24d71/home/v/workspaces/webstorm/newMIDIcheck/node_modules/keras-js/lib @ ./~/keras-js/lib/Model.js 215:50-63
ERROR in ./~/keras-js/lib/Tensor.js Module not found: Error: Cannot resolve 'file' or 'directory' ./texture_copy.glsl in /media/v/a218f425-0329-45ac-8571-5497bea24d71/home/v/workspaces/webstorm/newMIDIcheck/node_modules/keras-js/lib @ ./~/keras-js/lib/Tensor.js 142:40-70
it misses a lot of other glsl files, and yes, they aren't there. Also as far as fs goes, It shouldn't be used in the browser, how to get around that? Thanks everyone & srry for noob question.
I've also tried to use the bundle from keras-js /dist after building for browser, that one failed too.
These glsl files are missing, what is the reason behind that? They're included in this repo, but not in the node pkg.
I'm having the same problem, any news?
I've just deleted the file reading prop in the object + moved some glsl files and it worked for me.
where did you move the glsl files to?
I don't really remember. If you check the repo, you can find the missing glsl files. Move them into the same directory ( or wherever it looks for )
I've tried to use this library with npm, but also had similar problem:
These relative modules were not found:
* ./texture_copy.glsl in ./~/keras-js/lib/Tensor.js
* ./activation.glsl in ./~/keras-js/lib/ext/core/WebGLActivation.js
* ./input_transform.glsl in ./~/keras-js/lib/ext/convolutional/WebGLConv2D.js
* ./conv2d.glsl in ./~/keras-js/lib/ext/convolutional/WebGLConv2D.js
* ./maxpooling2d.glsl in ./~/keras-js/lib/ext/pooling/WebGLPooling2D.js
* ./avgpooling2d.glsl in ./~/keras-js/lib/ext/pooling/WebGLPooling2D.js
* ./batchnorm.glsl in ./~/keras-js/lib/ext/normalization/WebGLBatchNorm.js
Files was in the right places, simple copying had no effect. Finally, I solved this issue for me without copying files with changing webpack.config: From:
{ test: /\.(frag|vert)$/, use: ['raw-loader', 'glslify-loader']},
{ test: /\.(glsl)$/, use: ['raw-loader', 'glslify-loader']}
To:
{ test: /\.(glsl)$/, loader: 'url-loader'}