ALEXFLR commited on
Commit
c72a313
·
verified ·
1 Parent(s): 2e0ca9e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -12
README.md CHANGED
@@ -46,22 +46,28 @@ The main highlight of this model is the integration of a rare **bilinear layer (
46
  You can download the architecture file and the model weights directly from this repository:
47
 
48
  ```python
49
- import torch as t
50
- from huggingface_hub import hf_hub_download
51
 
52
- # 1. Download the architecture and weights files
53
- REPO_ID = "ALEXFLR/sbl-net"
54
- hf_hub_download(repo_id=REPO_ID, filename="model.py", local_dir=".")
55
- hf_hub_download(repo_id=REPO_ID, filename="model_weights_hybrid.pth", local_dir=".")
56
 
57
- # 2. Import the model class and load the weights
58
- from model import WebAISC
 
 
59
 
60
- model = WebAISC()
61
- model.load_state_dict(t.load("model_weights_hybrid.pth", map_location=t.device('cpu')))
62
- model.eval()
 
 
 
 
 
 
 
63
 
64
- # 3. Inference
65
  test_input = t.tensor([[-6.0, 70.0, 4.0, -196.0]], dtype=t.float32)
66
  with t.no_grad():
67
  prediction = model(test_input)
 
46
  You can download the architecture file and the model weights directly from this repository:
47
 
48
  ```python
49
+ class WebAISC(nn.Module):
 
50
 
51
+ def __init__(self):
52
+ super().__init__()
53
+ self.bilinear = nn.Bilinear(in1_features=2, in2_features=2, out_features=250)
 
54
 
55
+ self.x2 = nn.Linear(250, 100)
56
+ self.x3 = nn.Linear(100, 250)
57
+ self.x4 = nn.Linear(250, 1)
58
+ self.selu = nn.SELU()
59
 
60
+ def forward(self, x):
61
+ a = x[:, 0:2]
62
+ b = x[:, 2:4]
63
+
64
+ x = self.selu(self.bilinear(a, b))
65
+
66
+ x = self.selu(self.x2(x))
67
+ x = self.selu(self.x3(x))
68
+ x = self.x4(x)
69
+ return x
70
 
 
71
  test_input = t.tensor([[-6.0, 70.0, 4.0, -196.0]], dtype=t.float32)
72
  with t.no_grad():
73
  prediction = model(test_input)