deeplotx 0.9.13__tar.gz → 0.9.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.9.13 → deeplotx-0.9.15}/PKG-INFO +17 -33
- {deeplotx-0.9.13 → deeplotx-0.9.15}/README.md +16 -32
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx.egg-info/PKG-INFO +17 -33
- {deeplotx-0.9.13 → deeplotx-0.9.15}/pyproject.toml +1 -1
- {deeplotx-0.9.13 → deeplotx-0.9.15}/LICENSE +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/__init__.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/encoder/__init__.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/encoder/encoder.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/encoder/long_text_encoder.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/encoder/longformer_encoder.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/ner/__init__.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/ner/base_ner.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/ner/bert_ner.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/ner/n2g/__init__.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/ner/named_entity.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/__init__.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/attention.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/auto_regression.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/base_neural_network.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/feed_forward.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/linear_regression.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/logistic_regression.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/long_context_auto_regression.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/long_context_recursive_sequential.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/lora.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/multi_head_attention.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/multi_head_feed_forward.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/recursive_sequential.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/roformer_encoder.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/rope.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/nn/softmax_regression.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/similarity/__init__.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/similarity/distribution.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/similarity/set.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/similarity/vector.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx/util/__init__.py +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx.egg-info/SOURCES.txt +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx.egg-info/dependency_links.txt +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx.egg-info/requires.txt +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/deeplotx.egg-info/top_level.txt +0 -0
- {deeplotx-0.9.13 → deeplotx-0.9.15}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deeplotx
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.15
|
|
4
4
|
Summary: An out-of-the-box long-text NLP framework.
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -157,6 +157,21 @@ year = {2025}
|
|
|
157
157
|
(<Gender.Male: 'male'>, 1.0)
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
+
- ### Apply LoRA to a model
|
|
161
|
+
|
|
162
|
+
Import dependencies
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
from deeplotx import LoRA
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Assumed that the `model` has been loaded
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
model = ... # Maybe an LLM or some other deep neural network models
|
|
172
|
+
lora_model = LoRA.apply_to(model, target_modules=['q_proj'], rank=16, alpha=32, dropout_rate=.05)
|
|
173
|
+
```
|
|
174
|
+
|
|
160
175
|
- ### Long text embedding
|
|
161
176
|
|
|
162
177
|
- **BERT based long text embedding**
|
|
@@ -273,6 +288,7 @@ year = {2025}
|
|
|
273
288
|
RecursiveSequential,
|
|
274
289
|
LongContextRecursiveSequential,
|
|
275
290
|
RoPE,
|
|
291
|
+
LoRA,
|
|
276
292
|
Attention,
|
|
277
293
|
MultiHeadAttention,
|
|
278
294
|
RoFormerEncoder,
|
|
@@ -391,35 +407,3 @@ year = {2025}
|
|
|
391
407
|
v = self.v_proj(y)
|
|
392
408
|
return torch.matmul(self._attention(x, y, mask), v)
|
|
393
409
|
```
|
|
394
|
-
|
|
395
|
-
- ### Text binary classification task with predefined trainer
|
|
396
|
-
|
|
397
|
-
```python
|
|
398
|
-
from deeplotx import TextBinaryClassifierTrainer, LongTextEncoder
|
|
399
|
-
from deeplotx.util import get_files, read_file
|
|
400
|
-
|
|
401
|
-
long_text_encoder = LongTextEncoder(
|
|
402
|
-
max_length=2048,
|
|
403
|
-
chunk_size=448,
|
|
404
|
-
overlapping=32,
|
|
405
|
-
cache_capacity=512
|
|
406
|
-
)
|
|
407
|
-
trainer = TextBinaryClassifierTrainer(
|
|
408
|
-
long_text_encoder=long_text_encoder,
|
|
409
|
-
batch_size=2,
|
|
410
|
-
train_ratio=0.9
|
|
411
|
-
)
|
|
412
|
-
pos_data_path = 'path/to/pos_dir'
|
|
413
|
-
neg_data_path = 'path/to/neg_dir'
|
|
414
|
-
pos_data = [read_file(x) for x in get_files(pos_data_path)]
|
|
415
|
-
neg_data = [read_file(x) for x in get_files(neg_data_path)]
|
|
416
|
-
model = trainer.train(pos_data, neg_data,
|
|
417
|
-
num_epochs=36, learning_rate=2e-5,
|
|
418
|
-
balancing_dataset=True, alpha=1e-4,
|
|
419
|
-
rho=.2, encoder_layers=2,
|
|
420
|
-
attn_heads=8,
|
|
421
|
-
recursive_layers=2)
|
|
422
|
-
model.save(model_name='test_model', model_dir='model')
|
|
423
|
-
model = model.load(model_name='test_model', model_dir='model')
|
|
424
|
-
model.predict(long_text_encoder.encode('这是一个测试文本.', flatten=False))
|
|
425
|
-
```
|
|
@@ -136,6 +136,21 @@ year = {2025}
|
|
|
136
136
|
(<Gender.Male: 'male'>, 1.0)
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
+
- ### Apply LoRA to a model
|
|
140
|
+
|
|
141
|
+
Import dependencies
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
from deeplotx import LoRA
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Assumed that the `model` has been loaded
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
model = ... # Maybe an LLM or some other deep neural network models
|
|
151
|
+
lora_model = LoRA.apply_to(model, target_modules=['q_proj'], rank=16, alpha=32, dropout_rate=.05)
|
|
152
|
+
```
|
|
153
|
+
|
|
139
154
|
- ### Long text embedding
|
|
140
155
|
|
|
141
156
|
- **BERT based long text embedding**
|
|
@@ -252,6 +267,7 @@ year = {2025}
|
|
|
252
267
|
RecursiveSequential,
|
|
253
268
|
LongContextRecursiveSequential,
|
|
254
269
|
RoPE,
|
|
270
|
+
LoRA,
|
|
255
271
|
Attention,
|
|
256
272
|
MultiHeadAttention,
|
|
257
273
|
RoFormerEncoder,
|
|
@@ -370,35 +386,3 @@ year = {2025}
|
|
|
370
386
|
v = self.v_proj(y)
|
|
371
387
|
return torch.matmul(self._attention(x, y, mask), v)
|
|
372
388
|
```
|
|
373
|
-
|
|
374
|
-
- ### Text binary classification task with predefined trainer
|
|
375
|
-
|
|
376
|
-
```python
|
|
377
|
-
from deeplotx import TextBinaryClassifierTrainer, LongTextEncoder
|
|
378
|
-
from deeplotx.util import get_files, read_file
|
|
379
|
-
|
|
380
|
-
long_text_encoder = LongTextEncoder(
|
|
381
|
-
max_length=2048,
|
|
382
|
-
chunk_size=448,
|
|
383
|
-
overlapping=32,
|
|
384
|
-
cache_capacity=512
|
|
385
|
-
)
|
|
386
|
-
trainer = TextBinaryClassifierTrainer(
|
|
387
|
-
long_text_encoder=long_text_encoder,
|
|
388
|
-
batch_size=2,
|
|
389
|
-
train_ratio=0.9
|
|
390
|
-
)
|
|
391
|
-
pos_data_path = 'path/to/pos_dir'
|
|
392
|
-
neg_data_path = 'path/to/neg_dir'
|
|
393
|
-
pos_data = [read_file(x) for x in get_files(pos_data_path)]
|
|
394
|
-
neg_data = [read_file(x) for x in get_files(neg_data_path)]
|
|
395
|
-
model = trainer.train(pos_data, neg_data,
|
|
396
|
-
num_epochs=36, learning_rate=2e-5,
|
|
397
|
-
balancing_dataset=True, alpha=1e-4,
|
|
398
|
-
rho=.2, encoder_layers=2,
|
|
399
|
-
attn_heads=8,
|
|
400
|
-
recursive_layers=2)
|
|
401
|
-
model.save(model_name='test_model', model_dir='model')
|
|
402
|
-
model = model.load(model_name='test_model', model_dir='model')
|
|
403
|
-
model.predict(long_text_encoder.encode('这是一个测试文本.', flatten=False))
|
|
404
|
-
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deeplotx
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.15
|
|
4
4
|
Summary: An out-of-the-box long-text NLP framework.
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -157,6 +157,21 @@ year = {2025}
|
|
|
157
157
|
(<Gender.Male: 'male'>, 1.0)
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
+
- ### Apply LoRA to a model
|
|
161
|
+
|
|
162
|
+
Import dependencies
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
from deeplotx import LoRA
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Assumed that the `model` has been loaded
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
model = ... # Maybe an LLM or some other deep neural network models
|
|
172
|
+
lora_model = LoRA.apply_to(model, target_modules=['q_proj'], rank=16, alpha=32, dropout_rate=.05)
|
|
173
|
+
```
|
|
174
|
+
|
|
160
175
|
- ### Long text embedding
|
|
161
176
|
|
|
162
177
|
- **BERT based long text embedding**
|
|
@@ -273,6 +288,7 @@ year = {2025}
|
|
|
273
288
|
RecursiveSequential,
|
|
274
289
|
LongContextRecursiveSequential,
|
|
275
290
|
RoPE,
|
|
291
|
+
LoRA,
|
|
276
292
|
Attention,
|
|
277
293
|
MultiHeadAttention,
|
|
278
294
|
RoFormerEncoder,
|
|
@@ -391,35 +407,3 @@ year = {2025}
|
|
|
391
407
|
v = self.v_proj(y)
|
|
392
408
|
return torch.matmul(self._attention(x, y, mask), v)
|
|
393
409
|
```
|
|
394
|
-
|
|
395
|
-
- ### Text binary classification task with predefined trainer
|
|
396
|
-
|
|
397
|
-
```python
|
|
398
|
-
from deeplotx import TextBinaryClassifierTrainer, LongTextEncoder
|
|
399
|
-
from deeplotx.util import get_files, read_file
|
|
400
|
-
|
|
401
|
-
long_text_encoder = LongTextEncoder(
|
|
402
|
-
max_length=2048,
|
|
403
|
-
chunk_size=448,
|
|
404
|
-
overlapping=32,
|
|
405
|
-
cache_capacity=512
|
|
406
|
-
)
|
|
407
|
-
trainer = TextBinaryClassifierTrainer(
|
|
408
|
-
long_text_encoder=long_text_encoder,
|
|
409
|
-
batch_size=2,
|
|
410
|
-
train_ratio=0.9
|
|
411
|
-
)
|
|
412
|
-
pos_data_path = 'path/to/pos_dir'
|
|
413
|
-
neg_data_path = 'path/to/neg_dir'
|
|
414
|
-
pos_data = [read_file(x) for x in get_files(pos_data_path)]
|
|
415
|
-
neg_data = [read_file(x) for x in get_files(neg_data_path)]
|
|
416
|
-
model = trainer.train(pos_data, neg_data,
|
|
417
|
-
num_epochs=36, learning_rate=2e-5,
|
|
418
|
-
balancing_dataset=True, alpha=1e-4,
|
|
419
|
-
rho=.2, encoder_layers=2,
|
|
420
|
-
attn_heads=8,
|
|
421
|
-
recursive_layers=2)
|
|
422
|
-
model.save(model_name='test_model', model_dir='model')
|
|
423
|
-
model = model.load(model_name='test_model', model_dir='model')
|
|
424
|
-
model.predict(long_text_encoder.encode('这是一个测试文本.', flatten=False))
|
|
425
|
-
```
|
|
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
|
|
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
|