deeplotx 0.8.6__tar.gz → 0.8.7__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.
Files changed (40) hide show
  1. {deeplotx-0.8.6 → deeplotx-0.8.7}/PKG-INFO +1 -1
  2. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/base_neural_network.py +6 -3
  3. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/feed_forward.py +1 -1
  4. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/recursive_sequential.py +6 -3
  5. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx.egg-info/PKG-INFO +1 -1
  6. {deeplotx-0.8.6 → deeplotx-0.8.7}/pyproject.toml +1 -1
  7. {deeplotx-0.8.6 → deeplotx-0.8.7}/LICENSE +0 -0
  8. {deeplotx-0.8.6 → deeplotx-0.8.7}/README.md +0 -0
  9. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/__init__.py +0 -0
  10. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/encoder/__init__.py +0 -0
  11. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/encoder/encoder.py +0 -0
  12. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/encoder/long_text_encoder.py +0 -0
  13. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/encoder/longformer_encoder.py +0 -0
  14. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/__init__.py +0 -0
  15. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/attention.py +0 -0
  16. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/auto_regression.py +0 -0
  17. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/linear_regression.py +0 -0
  18. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/logistic_regression.py +0 -0
  19. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/long_context_auto_regression.py +0 -0
  20. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/long_context_recursive_sequential.py +0 -0
  21. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/multi_head_attention.py +0 -0
  22. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/multi_head_feed_forward.py +0 -0
  23. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/roformer_encoder.py +0 -0
  24. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/rope.py +0 -0
  25. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/nn/softmax_regression.py +0 -0
  26. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/similarity/__init__.py +0 -0
  27. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/similarity/distribution.py +0 -0
  28. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/similarity/set.py +0 -0
  29. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/similarity/vector.py +0 -0
  30. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/trainer/__init__.py +0 -0
  31. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/trainer/base_trainer.py +0 -0
  32. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/trainer/text_binary_classification_trainer.py +0 -0
  33. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/util/__init__.py +0 -0
  34. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/util/hash.py +0 -0
  35. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx/util/read_file.py +0 -0
  36. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx.egg-info/SOURCES.txt +0 -0
  37. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx.egg-info/dependency_links.txt +0 -0
  38. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx.egg-info/requires.txt +0 -0
  39. {deeplotx-0.8.6 → deeplotx-0.8.7}/deeplotx.egg-info/top_level.txt +0 -0
  40. {deeplotx-0.8.6 → deeplotx-0.8.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deeplotx
3
- Version: 0.8.6
3
+ Version: 0.8.7
4
4
  Summary: Easy-2-use long text NLP toolkit.
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -99,11 +99,14 @@ class BaseNeuralNetwork(nn.Module):
99
99
 
100
100
  def predict(self, x: torch.Tensor) -> torch.Tensor:
101
101
  x = self.ensure_device_and_dtype(x, device=self.device, dtype=self.dtype)
102
- __train = self.training
103
- self.training = False
102
+ training_state_dict = dict()
103
+ for m in self.modules():
104
+ training_state_dict[m] = m.training
105
+ m.training = False
104
106
  with torch.no_grad():
105
107
  res = self.forward(x)
106
- self.training = __train
108
+ for m, training_state in training_state_dict.items():
109
+ m.training = training_state
107
110
  return res
108
111
 
109
112
  def save(self, model_name: str | None = None, model_dir: str = '.', _suffix: str = DEFAULT_SUFFIX):
@@ -28,7 +28,7 @@ class FeedForwardUnit(BaseNeuralNetwork):
28
28
  x = self.layer_norm(x)
29
29
  x = self.up_proj(x)
30
30
  x = self.parametric_relu(x)
31
- if self._dropout_rate > .0:
31
+ if self._dropout_rate > .0 and self.training:
32
32
  x = torch.dropout(x, p=self._dropout_rate, train=self.training)
33
33
  return self.down_proj(x) + residual
34
34
 
@@ -41,9 +41,12 @@ class RecursiveSequential(BaseNeuralNetwork):
41
41
 
42
42
  @override
43
43
  def predict(self, x: torch.Tensor) -> torch.Tensor:
44
- __train = self.training
45
- self.training = False
44
+ training_state_dict = dict()
45
+ for m in self.modules():
46
+ training_state_dict[m] = m.training
47
+ m.training = False
46
48
  with torch.no_grad():
47
49
  res = self.forward(x.unsqueeze(0), self.initial_state(batch_size=1))[0]
48
- self.training = __train
50
+ for m, training_state in training_state_dict.items():
51
+ m.training = training_state
49
52
  return res
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deeplotx
3
- Version: 0.8.6
3
+ Version: 0.8.7
4
4
  Summary: Easy-2-use long text NLP toolkit.
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "deeplotx"
3
- version = "0.8.6"
3
+ version = "0.8.7"
4
4
  description = "Easy-2-use long text NLP toolkit."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes