Closed ToonTalk closed 5 years ago
Hitting the same issue with a speech recognition model in https://github.com/tensorflow/tfjs/issues/1657#issuecomment-506458895
@vadimkantorov Are you using the knn classifier? if not could you post a new issue if you see a memory leak in the speech recognition model.
@tafsiri No it's not a knn classifier, but I suspect it's also a memory issue
@vadimkantorov Are you using the knn classifier? if not could you post a new issue if you see a memory leak in the speech recognition model.
I am running into the same issue and using knn classifier, only on mobile (ios and android)
@Leekao please open a new issue here New Issue Template , thank you
TensorFlow.js version
1.04
Browser version
Chrome Version 73.0.3683.103 (Official Build) (64-bit)
Describe the problem or feature request
When using mobilenet and knn repeatedly with a memory leak (see issue #1498) it produces the following error messages instead of something indicating out of tensor memory:
Couldn't parse line number in error: tfjs.js:2 #version 300 es precision highp float; precision highp int; precision highp sampler2D; in vec2 resultUV; out vec4 outputColor; const vec2 halfCR = vec2(0.5, 0.5);
vec2 uvFromFlat(int texNumR, int texNumC, int index) { int texR = index / texNumC; int texC = index - texR texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); } vec2 packedUVfrom1D(int texNumR, int texNumC, int index) { int texelIndex = index / 2; int texR = texelIndex / texNumC; int texC = texelIndex - texR texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); }
vec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR, int texNumC, int row, int col) { int texelIndex = (row / 2) texelsInLogicalRow + (col / 2); int texR = texelIndex / texNumC; int texC = texelIndex - texR texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); }
vec2 packedUVfrom3D(int texNumR, int texNumC, int texelsInBatch, int texelsInLogicalRow, int b, int row, int col) { int index = b texelsInBatch + (row / 2) texelsInLogicalRow + (col / 2); int texR = index / texNumC; int texC = index - texR * texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); }
float getChannel(vec4 frag, vec2 innerDims) { vec2 modCoord = mod(innerDims, 2.); return modCoord.x == 0. ? (modCoord.y == 0. ? frag.r : frag.g) : (modCoord.y == 0. ? frag.b : frag.a); } float getChannel(vec4 frag, int dim) { float modCoord = mod(float(dim), 2.); return modCoord == 0. ? frag.r : frag.g; }
uniform sampler2D T0; uniform int offsetT0; uniform sampler2D T1; uniform int offsetT1;
tfjs.js:2 Uncaught Error: Failed to compile fragment shader. at kr (tfjs.js:2) at t.createProgram (tfjs.js:2) at tfjs.js:2 at tfjs.js:2 at t.getAndSaveBinary (tfjs.js:2) at t.compileAndRun (tfjs.js:2) at t.concat (tfjs.js:2) at tfjs.js:2 at tfjs.js:2 at t.scopedRun (tfjs.js:2) kr @ tfjs.js:2 t.createProgram @ tfjs.js:2 (anonymous) @ tfjs.js:2 (anonymous) @ tfjs.js:2 t.getAndSaveBinary @ tfjs.js:2 t.compileAndRun @ tfjs.js:2 t.concat @ tfjs.js:2 (anonymous) @ tfjs.js:2 (anonymous) @ tfjs.js:2 t.scopedRun @ tfjs.js:2 t.runKernel @ tfjs.js:2 concat_ @ tfjs.js:2 concat @ tfjs.js:2 t.concat @ tfjs.js:2 (anonymous) @ knn-classifier.js:2 (anonymous) @ tfjs.js:2 t.scopedRun @ tfjs.js:2 t.tidy @ tfjs.js:2 t.tidy @ tfjs.js:2 t.addExample @ knn-classifier.js:2 (anonymous) @ nails.js:305 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 load (async) load_image @ nails.js:217 add_image_to_training @ nails.js:302 next_image @ nails.js:241 (anonymous) @ nails.js:307 image.onload @ nails.js:218 localhost/:1 WebGL: CONTEXT_LOST_WEBGL: loseContext: context lost
Code to reproduce the bug / link to feature request
https://ecraft2learn.github.io/ai/onyx/memory-leak-index.html after a few minutes after loading - console shows the tf.memory on each iteration