deeplotx 0.4.12b6__tar.gz → 0.4.13__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.12b6 → deeplotx-0.4.13}/PKG-INFO +1 -1
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/nn/recursive_sequential.py +2 -3
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx.egg-info/PKG-INFO +1 -1
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx.egg-info/SOURCES.txt +1 -2
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/pyproject.toml +1 -1
- deeplotx-0.4.12b6/test/test.py +0 -21
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/LICENSE +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/README.md +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/__init__.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/encoder/__init__.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/encoder/bert_encoder.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/encoder/long_text_encoder.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/encoder/longformer_encoder.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/nn/__init__.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/nn/auto_regression.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/nn/base_neural_network.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/nn/linear_regression.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/nn/logistic_regression.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/nn/softmax_regression.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/similarity/__init__.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/similarity/distribution.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/similarity/set.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/similarity/vector.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/trainer/__init__.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/trainer/base_trainer.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/trainer/text_binary_classification_trainer.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/util/__init__.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/util/hash.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/util/read_file.py +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx.egg-info/dependency_links.txt +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx.egg-info/requires.txt +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx.egg-info/top_level.txt +0 -0
- {deeplotx-0.4.12b6 → deeplotx-0.4.13}/setup.cfg +0 -0
@@ -36,11 +36,10 @@ class RecursiveSequential(BaseNeuralNetwork):
|
|
36
36
|
return x, (hidden_state, cell_state)
|
37
37
|
|
38
38
|
@override
|
39
|
-
def predict(self, x
|
40
|
-
_batch_size = batch_size if batch_size is not None else x.shape[0]
|
39
|
+
def predict(self, x) -> torch.Tensor:
|
41
40
|
__train = self.training
|
42
41
|
self.training = False
|
43
42
|
with torch.no_grad():
|
44
|
-
res = self.forward(x, self.initial_state(batch_size=
|
43
|
+
res = self.forward(x.unsqueeze(0), self.initial_state(batch_size=1))[0]
|
45
44
|
self.training = __train
|
46
45
|
return res
|
deeplotx-0.4.12b6/test/test.py
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
from deeplotx import TextBinaryClassifierTrainer, LongTextEncoder
|
2
|
-
from deeplotx.util import get_files, read_file
|
3
|
-
|
4
|
-
long_text_encoder = LongTextEncoder(
|
5
|
-
max_length=2048,
|
6
|
-
chunk_size=512,
|
7
|
-
overlapping=128
|
8
|
-
)
|
9
|
-
|
10
|
-
trainer = TextBinaryClassifierTrainer(
|
11
|
-
long_text_encoder=long_text_encoder,
|
12
|
-
batch_size=4,
|
13
|
-
train_ratio=0.9
|
14
|
-
)
|
15
|
-
|
16
|
-
pos_data_path = './data/pos'
|
17
|
-
neg_data_path = './data/neg'
|
18
|
-
pos_data = [read_file(x) for x in get_files(pos_data_path)]
|
19
|
-
neg_data = [read_file(x) for x in get_files(neg_data_path)]
|
20
|
-
model = trainer.train(pos_data, neg_data, num_epochs=20, learning_rate=2e-5, train_loss_threshold=1)
|
21
|
-
model.predict(long_text_encoder.encode('这是一个测试文本.').squeeze())
|
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
|
{deeplotx-0.4.12b6 → deeplotx-0.4.13}/deeplotx/trainer/text_binary_classification_trainer.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|