deeplotx 0.9.13__py3-none-any.whl → 0.9.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deeplotx
3
- Version: 0.9.13
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
- ```
@@ -29,8 +29,8 @@ deeplotx/similarity/distribution.py,sha256=wQGouuuW531pZeBRKBujXsdsoz4fDnPw7_GW8
29
29
  deeplotx/similarity/set.py,sha256=zhGFxtSIXlWqvipBYzoiPahp4g0boAIoUiMfG0wl07A,686
30
30
  deeplotx/similarity/vector.py,sha256=WVbDHqykt-fvuILVrhUCtIFAOEjY_zvttrXGM9eylG0,1125
31
31
  deeplotx/util/__init__.py,sha256=d1qelOGVTLSsHp1R_gsP_FSMAtAxUxWMwiPrTS58RSg,66
32
- deeplotx-0.9.13.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
33
- deeplotx-0.9.13.dist-info/METADATA,sha256=_pdwcpo6iRSfeaD8VFxg4tIjfAxOXyeOFtRZRWQVLNw,14444
34
- deeplotx-0.9.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
- deeplotx-0.9.13.dist-info/top_level.txt,sha256=hKg4pVDXZ-WWxkRfJFczRIll1Sv7VyfKCmzHLXbuh1U,9
36
- deeplotx-0.9.13.dist-info/RECORD,,
32
+ deeplotx-0.9.15.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
33
+ deeplotx-0.9.15.dist-info/METADATA,sha256=8y2RddiUJGYpRITudVOnD4KnynqJNKfIEKYR6qietWI,13573
34
+ deeplotx-0.9.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
+ deeplotx-0.9.15.dist-info/top_level.txt,sha256=hKg4pVDXZ-WWxkRfJFczRIll1Sv7VyfKCmzHLXbuh1U,9
36
+ deeplotx-0.9.15.dist-info/RECORD,,