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.

RangeError: Source is too large

See original GitHub issue

What is wrong?

RangeError: Source is too large

Where does it happen?

In the a Neural Network when trying to train a net in GPU mode

How do we replicate the issue?

  • Step 1

Create a dummy tanning data set that total around 32k records like below,

    {
        "input": [
            "boston apartments",
            "condos for sale in boston",
            "marblehead real estate",
            "massachusetts real estate"
        ],
        "output": "Condos"
    }
  • Step 2

Now, Import it and run it like below,

const brain = require('brain.js');
const natural = require('natural')
const jsonfile = require('jsonfile');
const trainingDataSet = require('./sample.json');

const net = new brain.NeuralNetworkGPU();


net.train({trainingDataSet}{ log: (stats) => console.log(stats), iterations: 20000 });

jsonfile.writeFile("./trainedNet.json", net.toJSON());

Expected behavior (i.e. solution)

Should have run without this error

Version information

Nodejs:

v12.16.1

Browser:

Brain.js:

2.0.0-beta.2

How important is this (1-5)?

5

Other Comments

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
gerald-dotcomcommented, Oct 5, 2020

neuralNetworkGPU: net Doesn’t work. I am getting an error which ask to provide valid neural network.

Other thing is that without using GPU but using LSTM, I’m not getting the state info but it create a network.


    const trainStream = new brain.TrainStream({
        neuralNetwork: net,
        floodCallback: function () {
            encodedData.forEach(function (data) {
                trainStream.write(data);
            })
            trainStream.endInputs();
        },
        doneTrainingCallback: function (stats) {
            console.log(
                `trained in ${stats.iterations} iterations with error: ${stats.error}`
              );
        },
    });
0reactions
robertleeplummerjrcommented, Apr 13, 2022

The original questions mentions a data shape of the following:

"input": [
            "boston apartments",
            "condos for sale in boston",
            "marblehead real estate",
            "massachusetts real estate"
        ],
        "output": "Condos"

This must be broken up, and used with brain.recurrent.LSTM for it to work. brain.NeuralNetwork isn’t compatible with strings.

Example of how data should look:

[
  { "input": "boston apartments", "output": "Condos" },
  { "input": "condos for sale in boston", "output": "Condos" },
  { "input": "marblehead real estate", "output": "Condos" },
  { "input": "massachusetts real estate", "output": "Condos" },
]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Source is too large, multiple Float32Arrays - Stack Overflow
produces an error "Uncaught RangeError: Source is too large". At a glance it looks like it's just a normal Float32Array with 16 elements, ......
Read more >
Source is too large" in Chrome dev build (60.0.3100.0) · Issue ...
I can confirm this happens in Version 61.0.3141.7 (Official Build) dev (64-bit) also. On version <=59 works fine. Uncaught RangeError: Source is ......
Read more >
RangeError: Source is too large - Ionic Forum
Hi, I'm new to Ionic and Javascript. I have a bluetooth serial application receiving data from a device that it is showed in...
Read more >
Source is too large, multiple Float32Arrays-C++ - appsloveworld
Coding example for the question Emscripten Uncaught RangeError: Source is too large, multiple Float32Arrays-C++.
Read more >
RangeError: repeat count must be less than infinity - JavaScript
The JavaScript exception "repeat count must be less than infinity" occurs when the String.prototype.repeat() method is used with a count ...
Read more >

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