Arraymancer
Arraymancer copied to clipboard
Importing model refusing to output any information that is new?
network TwoLayersNet:
layers:
fc1: Linear(300, 42)
fc2: Linear(42, 300)
forward x:
x.fc1.relu.fc2
proc load*(ctx: Context[Tensor[float32]], inny : int): TwoLayersNet[float32] =
result.fc1.weight = ctx.variable(read_npy[float32](&"model/hiddenweight{inny}.npy"), requires_grad = true)
result.fc1.bias = ctx.variable(read_npy[float32](&"model/hiddenbias{inny}.npy"), requires_grad = true)
result.fc2.weight = ctx.variable(read_npy[float32](&"model/outputweight{inny}.npy"), requires_grad = true)
result.fc2.bias = ctx.variable(read_npy[float32](&"model/outputbias{inny}.npy"), requires_grad = true)
proc forward(network: TwoLayersNet, x: Variable): Variable =
result = x.linear(
network.fc1.weight, network.fc1.bias).relu.linear(
network.fc2.weight, network.fc2.bias)
This is essentially the same code as in the example, saved with the same function shown to me. But yet the output looks a bit like this.
I don't really know... what to do or where to go from here.
Can you either provide a fully working code example that showcases the issue or given that you said the existing example (https://github.com/mratsim/Arraymancer/blob/master/examples/ex07_save_load_model.nim) doesn't work for you either explain what's wrong with it?
edit: to expand on why that is important: without it I don't know what to tell you. The network you showed there might just be in a training state where that is expected etc. So without having some reproducible code that shows the training & predictions based on the trained network first, then serializes & deserializes and predicts again it's hard to help.