question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Memory Overallocation from tfjs version 0.12.4

See original GitHub issue

TensorFlow.js version

0.12.4 ~ 0.12.6

Browser version

Chrome 68.0.3440.106 , Firefox 61.0.2

Describe the problem or feature request

From tensorflow.js 0.12.4, when running a model with large input, RAM memory is abnormally allocated to the extent that it can’t handle the data.

Code to reproduce the bug / link to feature request

With tfjs posenet demo official repository, the bug can be reproduced.

To see working situation in 0.12.3
  1. clone the posenet demo repository, link
  2. version up the tfjs version to 0.12.3 by editing package.json (before editing the version is 0.11.4 in master branch)
  3. start the demo server: npm i && npm run watch
  4. change the input setting, and we can see the memory is in normal situation. image
To see memory bug situation in 0.12.4 ~ 0.12.6
  1. clone the posenet demo repository, link
  2. version up the tfjs version to 0.12.4 by editing package.json (before editing the version is 0.11.4 in master branch)
  3. start the demo server: npm i && npm run watch
  4. With the same input setting, we can see the memory overallocation with the demo application failing to work image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
tafsiricommented, Sep 6, 2018

@MoonsuCha Thanks this gives us an idea of what could be the cause (paging). Could you add the following lines to camera.js at around line 24 (after the imports):

console.log(tf.getBackend());
console.log(
    'Window Info',
    window.screen.height * window.screen.width * window.devicePixelRatio);
console.log('Paging Threshold', tf.ENV.backend.NUM_BYTES_BEFORE_PAGING);

Could you paste the output you get from that here? It should be at the top of the console

If that paging threshold is too low for an activation it could cause the problem you are seeing (and provide some data for us to fix it).

A workaround you could try is adding the following line after those console logs (near the top of the file).

tf.ENV.backend.NUM_BYTES_BEFORE_PAGING = Infinity;

this should turn of paging and possibly solve the problem (if its what I think it is).

1reaction
tehsenauscommented, Sep 7, 2018

I encountered the same issue when running a model on mobile devices. It turns out it’s easy to reproduce on a PC if you use a small screen width, which triggers paging.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found