deeplotx 0.4.13__tar.gz → 0.4.15__tar.gz
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-0.4.13 → deeplotx-0.4.15}/PKG-INFO +21 -19
- {deeplotx-0.4.13 → deeplotx-0.4.15}/README.md +20 -18
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/nn/base_neural_network.py +1 -1
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx.egg-info/PKG-INFO +21 -19
- {deeplotx-0.4.13 → deeplotx-0.4.15}/pyproject.toml +1 -1
- {deeplotx-0.4.13 → deeplotx-0.4.15}/LICENSE +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/__init__.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/encoder/__init__.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/encoder/bert_encoder.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/encoder/long_text_encoder.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/encoder/longformer_encoder.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/nn/__init__.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/nn/auto_regression.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/nn/linear_regression.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/nn/logistic_regression.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/nn/recursive_sequential.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/nn/softmax_regression.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/similarity/__init__.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/similarity/distribution.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/similarity/set.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/similarity/vector.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/trainer/__init__.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/trainer/base_trainer.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/trainer/text_binary_classification_trainer.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/util/__init__.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/util/hash.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx/util/read_file.py +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx.egg-info/SOURCES.txt +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx.egg-info/dependency_links.txt +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx.egg-info/requires.txt +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/deeplotx.egg-info/top_level.txt +0 -0
- {deeplotx-0.4.13 → deeplotx-0.4.15}/setup.cfg +0 -0
@@ -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)
|
@@ -160,31 +160,33 @@
|
|
160
160
|
|
161
161
|
import torch
|
162
162
|
from torch import nn
|
163
|
-
|
163
|
+
|
164
164
|
from deeplotx.nn.base_neural_network import BaseNeuralNetwork
|
165
|
-
|
166
|
-
|
165
|
+
|
166
|
+
|
167
167
|
class LinearRegression(BaseNeuralNetwork):
|
168
|
-
def __init__(self, input_dim: int, output_dim: int, model_name: str | None = None
|
169
|
-
|
170
|
-
|
171
|
-
self.
|
172
|
-
self.
|
173
|
-
self.
|
174
|
-
self.
|
175
|
-
self.
|
176
|
-
self.
|
177
|
-
self.
|
178
|
-
self.
|
179
|
-
self.
|
180
|
-
|
168
|
+
def __init__(self, input_dim: int, output_dim: int, model_name: str | None = None,
|
169
|
+
device: str | None = None, dtype: torch.dtype | None = None):
|
170
|
+
super().__init__(model_name=model_name, device=device, dtype=dtype)
|
171
|
+
self.fc1 = nn.Linear(input_dim, 1024, device=self.device, dtype=self.dtype)
|
172
|
+
self.fc1_to_fc4_res = nn.Linear(1024, 64, device=self.device, dtype=self.dtype)
|
173
|
+
self.fc2 = nn.Linear(1024, 768, device=self.device, dtype=self.dtype)
|
174
|
+
self.fc3 = nn.Linear(768, 128, device=self.device, dtype=self.dtype)
|
175
|
+
self.fc4 = nn.Linear(128, 64, device=self.device, dtype=self.dtype)
|
176
|
+
self.fc5 = nn.Linear(64, output_dim, device=self.device, dtype=self.dtype)
|
177
|
+
self.parametric_relu_1 = nn.PReLU(num_parameters=1, init=5e-3, device=self.device, dtype=self.dtype)
|
178
|
+
self.parametric_relu_2 = nn.PReLU(num_parameters=1, init=5e-3, device=self.device, dtype=self.dtype)
|
179
|
+
self.parametric_relu_3 = nn.PReLU(num_parameters=1, init=5e-3, device=self.device, dtype=self.dtype)
|
180
|
+
self.parametric_relu_4 = nn.PReLU(num_parameters=1, init=5e-3, device=self.device, dtype=self.dtype)
|
181
|
+
|
181
182
|
@override
|
182
183
|
def forward(self, x) -> torch.Tensor:
|
184
|
+
x = self.ensure_device_and_dtype(x, device=self.device, dtype=self.dtype)
|
183
185
|
fc1_out = self.parametric_relu_1(self.fc1(x))
|
184
|
-
x = nn.LayerNorm(normalized_shape=1024, eps=1e-9)(fc1_out)
|
186
|
+
x = nn.LayerNorm(normalized_shape=1024, eps=1e-9, device=self.device, dtype=self.dtype)(fc1_out)
|
185
187
|
x = torch.dropout(x, p=0.2, train=self.training)
|
186
188
|
x = self.parametric_relu_2(self.fc2(x))
|
187
|
-
x = nn.LayerNorm(normalized_shape=768, eps=1e-9)(x)
|
189
|
+
x = nn.LayerNorm(normalized_shape=768, eps=1e-9, device=self.device, dtype=self.dtype)(x)
|
188
190
|
x = torch.dropout(x, p=0.2, train=self.training)
|
189
191
|
x = self.parametric_relu_3(self.fc3(x))
|
190
192
|
x = torch.dropout(x, p=0.2, train=self.training)
|
@@ -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)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|