FluxML / FluxJS.jl

I heard you like compile times
Other
42 stars 8 forks source link

How to create weights? #9

Closed lokeshh closed 6 years ago

lokeshh commented 6 years ago

How to create weights for FluxJS?

I tired by training the model through Flux and then exporting the weights using following code:

m = Chain(
  Dense(28^2, 32, relu),
  Dense(32, 10),
  softmax)
...<train the model>
weights = Tracker.data.(params(m));
@save "mnist-mlp2.bson" weights

But upon loading the BSON I get following error: uncaught exception: Array type Core,Float64 not supported.

Roboneet commented 6 years ago

Alternatively, you could use

FluxJS.compile("mnist-mlp2", m, rand(28^2))

That will create mnist-mlp2.bson with the weights in a format which flux.js can load

lokeshh commented 6 years ago

Thanks! That fixed the problem.