oramasearch / onnx-go

onnx-go gives the ability to import a pre-trained neural network within Go without being linked to a framework or library.
https://blog.owulveryck.info/2019/04/03/from-a-project-to-a-product-the-state-of-onnx-go.html
MIT License
704 stars 72 forks source link

shame on the developers #217

Closed vadinabronin closed 4 months ago

vadinabronin commented 4 months ago

before you make your crap public, first test it for errors, here is the model code and then the code where I try to download it and run the tensor through it

class LSTMNetwork(nn.Module): def init(self, input_size, hidden_size, output_size): super(LSTMNetwork, self).init() self.hidden_size = hidden_size self.lstm = nn.LSTM(input_size, hidden_size) self.fc = nn.Linear(hidden_size, output_size) self.sigmoid = nn.Sigmoid()

def forward(self, input_seq):
    lstm_out, _ = self.lstm(input_seq)
    output = self.fc(lstm_out[:,-1,:])
    output = self.sigmoid(output)
    return output

package main

import ( "fmt" "io/ioutil" "github.com/owulveryck/onnx-go" "github.com/owulveryck/onnx-go/backend/x/gorgonnx" "gorgonia.org/tensor" )

func main() { backend := gorgonnx.NewGraph() model := onnx.NewModel(backend)

b, _ := ioutil.ReadFile("model.onnx")
err := model.UnmarshalBinary(b)
if err != nil {
    fmt.Println(err)
    return
}
fmt.Println(model)

input := tensor.New(tensor.WithBacking(tensor.Range(tensor.Float32, 0, 81 * 5)), tensor.WithShape(1, 5, 81))
fmt.Println(
model.SetInput(0, input)
err = backend.Run()
if err != nil {
    fmt.Println(err)
    return
}
output, _ := model.GetOutputTensors()
fmt.Println(output[0])

}

an error occurs onnx: operator Shape not implemented (), I can’t find any other explanation for the occurrence of this error other than the stupidity of the developers of this library, the model is absolutely correct and has been preserved in onnx.

owulveryck commented 4 months ago

What is the purpose of your comment?

vadinabronin commented 4 months ago

my purpose is what going on in your library, why i get error in easy example, did you test your library or no?

vadinabronin commented 4 months ago

I'm sorry it bombed me, I just hate it when errors like this occur in public libraries

vadinabronin commented 4 months ago

onnx: operator Shape not implemented () - what is what is operator Shape i dont have operator shape in my model

owulveryck commented 4 months ago

I understand that you might be new to the business and still gaining experience, so I will overlook the issues with communication this time. However, I hope you use this opportunity to learn and improve.

Open source is much more than just sharing code. It involves dedicating time to the community to enhance and improve projects.

I developed this library a few years ago during my spare time, working nights because I genuinely believed in the concept of self-sufficient deep-learning models. I thought Go could serve as a portable inference engine, simplifying the operations part (what we now call MLOps).

I did my best to run tests, but the development of ONNX progressed much faster than I could keep up with (Microsoft had teams of developers working on it, while I was mostly alone).

I left this project open because, even though I don't have time to maintain it, I believe it could still be useful to people like you. I assume you have a use case if you're trying to use this project.

With that said, I apologize for not setting a notice in the README earlier, indicating that I am no longer actively maintaining the project. I didn't do it because I kept hoping someone would take over and continue its development.

Now, to address your questions: when I built the library, I conducted many tests based on the context at that time. Obviously, I didn't test everything, and practices like TDD might not have helped much. Regarding you error, there is probably a Shape operator somewhere, maybe due to the onnx serialization, or it is a bug, I don't know.

I guess that it is time to archive this project though.

And one last piece of advice: be kind to people, think before you speak, and read before you think. Your comment hurt can hurt people, and certainly hurt me.