romanpro23 / NeuralNetworkCPU

MIT License
5 stars 1 forks source link

I get an error while loading from a file #1

Open SunnyPage opened 1 year ago

SunnyPage commented 1 year ago

Hello, I discovered your library a few days ago. A very good library. I'm trying to train a Visual transformer. I started testing TestVIT. "Save" network works. But when I tried "Load" - I get an error! Please help fix...

NeuralNetwork network = NeuralNetwork.read(new Scanner(new File("capsnet.txt"))) .setOptimizer(new AdamOptimizer()) .setFunctionLoss(new FunctionLoss.MSE()) .create();

java.lang.NumberFormatException: For input string: "0.0014131109" at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67) at java.base/java.lang.Integer.parseInt(Integer.java:665) at java.base/java.lang.Integer.parseInt(Integer.java:781) at java.base/java.util.stream.ReferencePipeline$4$1.accept(ReferencePipeline.java:214) at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1006) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) at java.base/java.util.stream.IntPipeline.toArray(IntPipeline.java:562) at nnarrays.NNMatrix.read(NNMatrix.java:314)

romanpro23 commented 1 year ago

Hello, you might be getting this error because there was a crash while writing the neural network file, which has corrupted the file and thus cannot be read from. Try to save the file again, and then open it.

SunnyPage commented 1 year ago

Many thanks for the help.

I also added to ImagePatchesLayer-save()->writer.write(this.returnGradient + "\n"); I think it was skipped. And also added to MultiHeadAttentionLayer->read()-> int[] size = new int[2]; size[0] = layer.mask.getRow(); size[1] = layer.sizeAttention; layer.initialize(size);

I am trying to create speech recognition for Georgian language. I tried to train 190 sentence audio files. After 8 hours of training on i7-8565U. Successfully trained. I used 12 Head Attention instead of 4 heads.

I have one question. Under what license is this project distributed?

romanpro23 commented 1 year ago

Thanks for the tips. I have also added a standard license to the project, use it for your purposes.