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

Error when call model.predict #44

Closed
offchan42 opened this issue Feb 8, 2017 · 3 comments
Closed

Error when call model.predict #44

offchan42 opened this issue Feb 8, 2017 · 3 comments

Comments

@offchan42
Copy link

offchan42 commented Feb 8, 2017

It's saying that there are a token |= but my code only has one file index.html and it has no such symbol.
What is the cause here?

SyntaxError: Unexpected token |=
    at new Function (<anonymous>)
    at u (https://off99555.github.io/HoNNeT/keras-js/keras.js:13:8807)
    at assigns_cwise_thunk (eval at r (https://off99555.github.io/HoNNeT/keras-js/keras.js:13:10619), <anonymous>:7:29)
    at Object.assigns_ndarrayops [as assigns] (eval at i (https://off99555.github.io/HoNNeT/keras-js/keras.js:1:6744), <anonymous>:3:44)
    at e.value (https://off99555.github.io/HoNNeT/keras-js/keras.js:7:19739)
    at e.value (https://off99555.github.io/HoNNeT/keras-js/keras.js:7:21879)
    at t.value (https://off99555.github.io/HoNNeT/keras-js/keras.js:4:15902)
    at t.<anonymous> (https://off99555.github.io/HoNNeT/keras-js/keras.js:4:16786)
    at o (https://off99555.github.io/HoNNeT/keras-js/keras.js:16:7592)
    at Generator._invoke (https://off99555.github.io/HoNNeT/keras-js/keras.js:16:9001)
    at Generator.t.(anonymous function) [as next] (https://off99555.github.io/HoNNeT/keras-js/keras.js:16:7771)
    at Generator.i (https://off99555.github.io/HoNNeT/keras-js/keras.js:11:1532)
    at u._promiseFulfilled (https://off99555.github.io/HoNNeT/keras-js/keras.js:9:22799)
    at t.<anonymous> (https://off99555.github.io/HoNNeT/keras-js/keras.js:9:24615)
From previous event:
    at t (https://off99555.github.io/HoNNeT/keras-js/keras.js:4:15972)
    at t.<anonymous> (https://off99555.github.io/HoNNeT/keras-js/keras.js:4:18474)
    at o (https://off99555.github.io/HoNNeT/keras-js/keras.js:16:7592)
    at Generator._invoke (https://off99555.github.io/HoNNeT/keras-js/keras.js:16:9001)
    at Generator.t.(anonymous function) [as next] (https://off99555.github.io/HoNNeT/keras-js/keras.js:16:7771)
From previous event:
    at t (https://off99555.github.io/HoNNeT/keras-js/keras.js:4:17225)
    at model.ready.then (https://off99555.github.io/HoNNeT/:165:16)
From previous event:
    at https://off99555.github.io/HoNNeT/:158:20

Here's the javascript part of that index.html file:

     const N_AVAIL_HEROES = 260
     const HERO_INPUT = new Array(2 * N_AVAIL_HEROES).fill(0)
     const vm = new Vue({
         el: '#app',
         data() {
             return {
                 model: null,
                 modelReady: false
             }
         },
         watch: {
             modelReady: function() {
                 if (this.modelReady)
                     console.log('the model is ready now')
             }
         }
     })
     const model = new KerasJS.Model({
         filepaths: {
             model: 'honnet_brain_architecture.json',
             weights: 'honnet_brain_weights_weights.buf',
             metadata: 'honnet_brain_weights_metadata.json'
         }
     })
     function getInputData(legion, hellbourne) {
        console.log('predicting with data')
        const inputData = {
            'hero_input': new Float32Array(HERO_INPUT)
        }
        return inputData
     }
     model.ready().then(() => {
         vm.model = model
         vm.modelReady = true

         // make predictions
         // outputData is an object keyed by names of the output layers
         // or `output` for Sequential models
         model.predict(getInputData([], [])).then(function(outputData) { // <====== error happens here!
             console.log('output')
             console.log(outputData)
         }).catch(err => {
             // handle error
             console.log('pred error: ')
             console.log(err)
         })
     }).catch(err => {
         // handle error
         console.log('ready error: ')
         console.log(err)
     })
@offchan42
Copy link
Author

This is the full log message from the console:

predicting with data
keras.js:9 Warning: a promise was created in a handler at https://off99555.github.io/HoNNeT/:165:16 but was not returned from it, see http://goo.gl/rRqMUw
    at t.<anonymous> (https://off99555.github.io/HoNNeT/keras-js/keras.js:9:24552)
    at t (https://off99555.github.io/HoNNeT/keras-js/keras.js:4:17225)
    at model.ready.then (https://off99555.github.io/HoNNeT/:165:16)
From previous event:
    at https://off99555.github.io/HoNNeT/:158:20
N @ keras.js:9
O @ keras.js:9
g @ keras.js:9
n._warn @ keras.js:9
m @ keras.js:9
i._settlePromiseFromHandler @ keras.js:10
i._settlePromise @ keras.js:10
i._settlePromise0 @ keras.js:10
i._settlePromises @ keras.js:10
i._fulfill @ keras.js:10
i._settlePromise @ keras.js:10
i._settlePromise0 @ keras.js:10
i._settlePromises @ keras.js:10
i._fulfill @ keras.js:10
i._resolveCallback @ keras.js:10
i._settlePromiseFromHandler @ keras.js:10
i._settlePromise @ keras.js:10
i._settlePromise0 @ keras.js:10
i._settlePromises @ keras.js:10
i._fulfill @ keras.js:10
s._resolve @ keras.js:10
s._promiseFulfilled @ keras.js:10
i._settlePromise @ keras.js:10
i._settlePromise0 @ keras.js:10
i._settlePromises @ keras.js:10
(anonymous) @ keras.js:8
(index):140 the model is ready now
(index):170 pred error: 
(index):171 SyntaxError: Unexpected token |=
    at new Function (<anonymous>)
    at u (https://off99555.github.io/HoNNeT/keras-js/keras.js:13:8807)
    at assigns_cwise_thunk (eval at r (https://off99555.github.io/HoNNeT/keras-js/keras.js:13:10619), <anonymous>:7:29)
    at Object.assigns_ndarrayops [as assigns] (eval at i (https://off99555.github.io/HoNNeT/keras-js/keras.js:1:6744), <anonymous>:3:44)
    at e.value (https://off99555.github.io/HoNNeT/keras-js/keras.js:7:19739)
    at e.value (https://off99555.github.io/HoNNeT/keras-js/keras.js:7:21879)
    at t.value (https://off99555.github.io/HoNNeT/keras-js/keras.js:4:15902)
    at t.<anonymous> (https://off99555.github.io/HoNNeT/keras-js/keras.js:4:16786)
    at o (https://off99555.github.io/HoNNeT/keras-js/keras.js:16:7592)
    at Generator._invoke (https://off99555.github.io/HoNNeT/keras-js/keras.js:16:9001)
    at Generator.t.(anonymous function) [as next] (https://off99555.github.io/HoNNeT/keras-js/keras.js:16:7771)
    at Generator.i (https://off99555.github.io/HoNNeT/keras-js/keras.js:11:1532)
    at u._promiseFulfilled (https://off99555.github.io/HoNNeT/keras-js/keras.js:9:22799)
    at t.<anonymous> (https://off99555.github.io/HoNNeT/keras-js/keras.js:9:24615)
From previous event:
    at t (https://off99555.github.io/HoNNeT/keras-js/keras.js:4:15972)
    at t.<anonymous> (https://off99555.github.io/HoNNeT/keras-js/keras.js:4:18474)
    at o (https://off99555.github.io/HoNNeT/keras-js/keras.js:16:7592)
    at Generator._invoke (https://off99555.github.io/HoNNeT/keras-js/keras.js:16:9001)
    at Generator.t.(anonymous function) [as next] (https://off99555.github.io/HoNNeT/keras-js/keras.js:16:7771)
From previous event:
    at t (https://off99555.github.io/HoNNeT/keras-js/keras.js:4:17225)
    at model.ready.then (https://off99555.github.io/HoNNeT/:165:16)
From previous event:
    at https://off99555.github.io/HoNNeT/:158:20

@offchan42
Copy link
Author

offchan42 commented Feb 8, 2017

@offchan42
Copy link
Author

OK. I'm closing this issue because I don't use keras-js in my repository now. I'm using a flask app instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant