chore: ad base model
Browse files- config.json +4 -0
- model.onnx +3 -0
- requirements.txt +1 -0
- src/init_model.py +18 -0
config.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"model_type": "onnx-base",
|
3 |
+
"model_name_or_path": "model.onnx"
|
4 |
+
}
|
model.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:340fee2e31d28c3d73f480c802a5c10f81bfe067ec4658c8dade05943dcab2b4
|
3 |
+
size 271
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
torch
|
src/init_model.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import torch.nn as nn
|
3 |
+
import torch.onnx
|
4 |
+
|
5 |
+
# Define a simple model
|
6 |
+
class SimpleModel(nn.Module):
|
7 |
+
def __init__(self):
|
8 |
+
super(SimpleModel, self).__init__()
|
9 |
+
self.fc = nn.Linear(10, 1)
|
10 |
+
|
11 |
+
def forward(self, x):
|
12 |
+
return self.fc(x)
|
13 |
+
|
14 |
+
# Instantiate and export the model
|
15 |
+
model = SimpleModel()
|
16 |
+
dummy_input = torch.randn(1, 10)
|
17 |
+
onnx_path = "../model.onnx"
|
18 |
+
torch.onnx.export(model, dummy_input, onnx_path, input_names=['input'], output_names=['output'])
|