deeplotx 0.4.13__py3-none-any.whl → 0.4.15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- deeplotx/nn/base_neural_network.py +1 -1
- {deeplotx-0.4.13.dist-info → deeplotx-0.4.15.dist-info}/METADATA +21 -19
- {deeplotx-0.4.13.dist-info → deeplotx-0.4.15.dist-info}/RECORD +6 -6
- {deeplotx-0.4.13.dist-info → deeplotx-0.4.15.dist-info}/WHEEL +0 -0
- {deeplotx-0.4.13.dist-info → deeplotx-0.4.15.dist-info}/licenses/LICENSE +0 -0
- {deeplotx-0.4.13.dist-info → deeplotx-0.4.15.dist-info}/top_level.txt +0 -0
@@ -58,5 +58,5 @@ class BaseNeuralNetwork(nn.Module):
|
|
58
58
|
return self
|
59
59
|
|
60
60
|
def load(self):
|
61
|
-
self.load_state_dict(torch.load(f'{self._model_name}.deeplotx'))
|
61
|
+
self.load_state_dict(torch.load(f'{self._model_name}.deeplotx', map_location=self.device, weights_only=True))
|
62
62
|
return self
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: deeplotx
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.15
|
4
4
|
Summary: Easy-2-use long text NLP toolkit.
|
5
5
|
Requires-Python: >=3.10
|
6
6
|
Description-Content-Type: text/markdown
|
@@ -177,31 +177,33 @@ Dynamic: license-file
|
|
177
177
|
|
178
178
|
import torch
|
179
179
|
from torch import nn
|
180
|
-
|
180
|
+
|
181
181
|
from deeplotx.nn.base_neural_network import BaseNeuralNetwork
|
182
|
-
|
183
|
-
|
182
|
+
|
183
|
+
|
184
184
|
class LinearRegression(BaseNeuralNetwork):
|
185
|
-
def __init__(self, input_dim: int, output_dim: int, model_name: str | None = None
|
186
|
-
|
187
|
-
|
188
|
-
self.
|
189
|
-
self.
|
190
|
-
self.
|
191
|
-
self.
|
192
|
-
self.
|
193
|
-
self.
|
194
|
-
self.
|
195
|
-
self.
|
196
|
-
self.
|
197
|
-
|
185
|
+
def __init__(self, input_dim: int, output_dim: int, model_name: str | None = None,
|
186
|
+
device: str | None = None, dtype: torch.dtype | None = None):
|
187
|
+
super().__init__(model_name=model_name, device=device, dtype=dtype)
|
188
|
+
self.fc1 = nn.Linear(input_dim, 1024, device=self.device, dtype=self.dtype)
|
189
|
+
self.fc1_to_fc4_res = nn.Linear(1024, 64, device=self.device, dtype=self.dtype)
|
190
|
+
self.fc2 = nn.Linear(1024, 768, device=self.device, dtype=self.dtype)
|
191
|
+
self.fc3 = nn.Linear(768, 128, device=self.device, dtype=self.dtype)
|
192
|
+
self.fc4 = nn.Linear(128, 64, device=self.device, dtype=self.dtype)
|
193
|
+
self.fc5 = nn.Linear(64, output_dim, device=self.device, dtype=self.dtype)
|
194
|
+
self.parametric_relu_1 = nn.PReLU(num_parameters=1, init=5e-3, device=self.device, dtype=self.dtype)
|
195
|
+
self.parametric_relu_2 = nn.PReLU(num_parameters=1, init=5e-3, device=self.device, dtype=self.dtype)
|
196
|
+
self.parametric_relu_3 = nn.PReLU(num_parameters=1, init=5e-3, device=self.device, dtype=self.dtype)
|
197
|
+
self.parametric_relu_4 = nn.PReLU(num_parameters=1, init=5e-3, device=self.device, dtype=self.dtype)
|
198
|
+
|
198
199
|
@override
|
199
200
|
def forward(self, x) -> torch.Tensor:
|
201
|
+
x = self.ensure_device_and_dtype(x, device=self.device, dtype=self.dtype)
|
200
202
|
fc1_out = self.parametric_relu_1(self.fc1(x))
|
201
|
-
x = nn.LayerNorm(normalized_shape=1024, eps=1e-9)(fc1_out)
|
203
|
+
x = nn.LayerNorm(normalized_shape=1024, eps=1e-9, device=self.device, dtype=self.dtype)(fc1_out)
|
202
204
|
x = torch.dropout(x, p=0.2, train=self.training)
|
203
205
|
x = self.parametric_relu_2(self.fc2(x))
|
204
|
-
x = nn.LayerNorm(normalized_shape=768, eps=1e-9)(x)
|
206
|
+
x = nn.LayerNorm(normalized_shape=768, eps=1e-9, device=self.device, dtype=self.dtype)(x)
|
205
207
|
x = torch.dropout(x, p=0.2, train=self.training)
|
206
208
|
x = self.parametric_relu_3(self.fc3(x))
|
207
209
|
x = torch.dropout(x, p=0.2, train=self.training)
|
@@ -5,7 +5,7 @@ deeplotx/encoder/long_text_encoder.py,sha256=hl_O8kR9o1kcII9YfSx2rf_Pk0l_Rv7LNbs
|
|
5
5
|
deeplotx/encoder/longformer_encoder.py,sha256=A8FXqd4mdHxSn_o_R689XtpT73ISDT788EgMQRGLC2g,1822
|
6
6
|
deeplotx/nn/__init__.py,sha256=oQ-vYXyuaGelfCOs2im_gZXAiiBlCCVXh1uw9yjvRMs,253
|
7
7
|
deeplotx/nn/auto_regression.py,sha256=7P63opWCWMqE2DigwbsL6kfXtFtJPz00Yo1RqflBz4A,572
|
8
|
-
deeplotx/nn/base_neural_network.py,sha256=
|
8
|
+
deeplotx/nn/base_neural_network.py,sha256=oGlqY6ZZ3DGOXWQQ9nZ7ktJpfyIaUrSraGnFRbGD1jM,2384
|
9
9
|
deeplotx/nn/linear_regression.py,sha256=_LQFrOKBbQxvuNzb_B8Mr6PAQJUg-pFeu3h7_jQz04o,2166
|
10
10
|
deeplotx/nn/logistic_regression.py,sha256=j8QGe0e7In97RMOXApJRID85qf1rOUCOk3V368CBfqs,653
|
11
11
|
deeplotx/nn/recursive_sequential.py,sha256=pHZChjzw9cuMQ0lmv42lxxVgxCU6D7owOgph0Irj-w4,2219
|
@@ -20,8 +20,8 @@ deeplotx/trainer/text_binary_classification_trainer.py,sha256=Wq_pGO78zgdXxFeBja
|
|
20
20
|
deeplotx/util/__init__.py,sha256=JxqAK_WOOHcYVSTHBT1-WuBwWrPEVDTV3titeVWvNUM,74
|
21
21
|
deeplotx/util/hash.py,sha256=wwsC6kOQvbpuvwKsNQOARd78_wePmW9i3oaUuXRUnpc,352
|
22
22
|
deeplotx/util/read_file.py,sha256=ptzouvEQeeW8KU5BrWNJlXw-vFXVrpS9SkAUxsu6A8A,612
|
23
|
-
deeplotx-0.4.
|
24
|
-
deeplotx-0.4.
|
25
|
-
deeplotx-0.4.
|
26
|
-
deeplotx-0.4.
|
27
|
-
deeplotx-0.4.
|
23
|
+
deeplotx-0.4.15.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
|
24
|
+
deeplotx-0.4.15.dist-info/METADATA,sha256=HB6VHdLgyuMclJYLykBMnbnLa7s-rwfHyhrgjNdoRFQ,6955
|
25
|
+
deeplotx-0.4.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
26
|
+
deeplotx-0.4.15.dist-info/top_level.txt,sha256=hKg4pVDXZ-WWxkRfJFczRIll1Sv7VyfKCmzHLXbuh1U,9
|
27
|
+
deeplotx-0.4.15.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|