wolof-translate 0.0.3__tar.gz → 0.0.4__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.
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/PKG-INFO +1 -1
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/setup.py +1 -1
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/bucket_iterator.py +40 -9
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate.egg-info/PKG-INFO +1 -1
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/setup.cfg +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/__init__.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/__pycache__/__init__.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/__pycache__/__init__.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/__pycache__/dataset_v1.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/__pycache__/sent_transformers.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/__init__.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/__pycache__/__init__.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/__pycache__/__init__.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/__pycache__/dataset_v1.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/__pycache__/dataset_v2.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/__pycache__/dataset_v3.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/__pycache__/dataset_v3.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/__pycache__/dataset_v4.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/__pycache__/dataset_v4.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/dataset_v1.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/dataset_v2.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/dataset_v3.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/dataset_v3_2.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/dataset_v4.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/data/dataset_v5.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/__init__.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/__pycache__/__init__.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/__pycache__/__init__.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/french/tfidfaug_w2idf.txt +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/french/tfidfaug_w2tfidf.txt +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/__init__.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/__pycache__/__init__.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/__pycache__/__init__.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/__pycache__/main.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/__pycache__/main.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/__pycache__/optimization.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/__pycache__/optimization.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/__pycache__/position.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/__pycache__/position.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/__pycache__/size.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/__pycache__/size.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/main.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/main_2.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/optimization.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/position.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/size.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/wolof/tfidfaug_w2idf.txt +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/wolof/tfidfaug_w2tfidf.txt +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/pipe/__init__.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/pipe/__pycache__/__init__.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/pipe/__pycache__/nlp_pipeline.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/pipe/nlp_pipeline.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/__init__.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/__pycache__/__init__.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/adverse_tokenizer.json +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/bart_tokenizers/tokenizer_v3.json +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/bart_tokenizers/tokenizer_v3_2.json +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/bart_tokenizers/tokenizer_v5.json +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers/tokenizer_v3.model +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers/tokenizer_v3.vocab +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers/tokenizer_v4.model +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers/tokenizer_v4.vocab +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers/tokenizer_v5.model +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers/tokenizer_v5.vocab +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers/tokenizer_v6.model +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers/tokenizer_v6.vocab +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers/tokenizer_v7.model +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers/tokenizer_v7.vocab +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers/tokenizer_v8.model +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers/tokenizer_v8.vocab +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers/tokenizer_v9.model +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers/tokenizer_v9.vocab +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers.zip +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/tokenizer_v1.json +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/tokenizer_v3_2.json +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/trax/sentencepiece_tokenizer_v4.subwords +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/trax/sentencepiece_tokenizer_v5.subwords +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/trax/sentencepiece_tokenizer_v6.subwords +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/trax/sentencepiece_tokenizer_v7.subwords +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/__init__.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/__pycache__/__init__.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/__pycache__/__init__.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/__pycache__/transformer_trainer.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/__pycache__/transformer_trainer.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/__pycache__/transformer_trainer_custom.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/__pycache__/transformer_trainer_ml.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/__pycache__/transformer_trainer_ml_.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/transformer_trainer.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/transformer_trainer_custom.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/transformer_trainer_ml.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/transformer_trainer_ml_.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__init__.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/__init__.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/__init__.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/bucket_iterator.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/database_manager.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/display_predictions.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/download_model.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/evaluate_custom.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/evaluation.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/evaluation.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/extract_new_sentences.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/recuperate_datasets.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/sent_corrections.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/sent_corrections.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/sent_transformers.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/sent_transformers.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/sent_unification.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/split_with_valid.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/split_with_valid.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/tokenize_text.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/__pycache__/training.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/database_manager.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/display_predictions.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/download_model.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/evaluate_custom.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/evaluation.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/extract_new_sentences.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/extract_poems.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/extract_sentences.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/improvements/__init__.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/improvements/__pycache__/__init__.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/improvements/__pycache__/__init__.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/improvements/__pycache__/end_marks.cpython-310.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/improvements/__pycache__/end_marks.cpython-311.pyc +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/improvements/end_marks.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/recuperate_datasets.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/recuperate_datasets_trunc.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/send_model.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/sent_corrections.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/sent_transformers.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/sent_unification.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/split_with_valid.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/tokenize_text.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/training.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/trunc_hg_training.py +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate.egg-info/SOURCES.txt +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate.egg-info/dependency_links.txt +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate.egg-info/requires.txt +0 -0
- {wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate.egg-info/top_level.txt +0 -0
|
@@ -2,7 +2,7 @@ from setuptools import setup
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="wolof_translate",
|
|
5
|
-
version="0.0.
|
|
5
|
+
version="0.0.4",
|
|
6
6
|
author="Oumar Kane",
|
|
7
7
|
author_email="oumar.kane@univ-thies.sn",
|
|
8
8
|
description="Contain function and classes to process corpora for making translation between wolof text and other languages.",
|
|
@@ -5,29 +5,43 @@ from math import ceil
|
|
|
5
5
|
from tqdm import tqdm
|
|
6
6
|
import time
|
|
7
7
|
|
|
8
|
+
|
|
8
9
|
class SequenceLengthBatchSampler(Sampler[List[int]]):
|
|
9
10
|
def __init__(
|
|
10
11
|
self,
|
|
11
12
|
dataset,
|
|
12
13
|
boundaries: List[int],
|
|
13
14
|
batch_sizes: List[int],
|
|
14
|
-
input_key: Optional[int] = None,
|
|
15
|
-
label_key: Optional[int] = None,
|
|
15
|
+
input_key: Optional[Union[int, str]] = None,
|
|
16
|
+
label_key: Optional[Union[int, str]] = None,
|
|
16
17
|
drop_unique: bool = True,
|
|
17
18
|
):
|
|
19
|
+
"""
|
|
20
|
+
Sampler that batches sequences of similar lengths together to minimize padding.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
dataset: Dataset to sample from.
|
|
24
|
+
boundaries: List of length boundaries to bucket sequences.
|
|
25
|
+
batch_sizes: List of batch sizes per bucket (length must be len(boundaries)+1).
|
|
26
|
+
input_key: Key or index to access input sequence in dataset item.
|
|
27
|
+
label_key: Key or index to access label sequence in dataset item.
|
|
28
|
+
drop_unique: Whether to drop batches with a single leftover element.
|
|
29
|
+
"""
|
|
18
30
|
self.dataset = dataset
|
|
19
31
|
self.boundaries = boundaries
|
|
20
32
|
self.batch_sizes = batch_sizes
|
|
21
33
|
self.drop_unique = drop_unique
|
|
22
34
|
|
|
35
|
+
assert len(batch_sizes) == len(boundaries) + 1, (
|
|
36
|
+
f"batch_sizes length ({len(batch_sizes)}) must be one more than boundaries length ({len(boundaries)})"
|
|
37
|
+
)
|
|
38
|
+
|
|
23
39
|
start_time = time.time()
|
|
24
40
|
tqdm.write("Computing sequence lengths...")
|
|
25
41
|
|
|
26
|
-
# Compute lengths with tqdm progress bar
|
|
27
42
|
self.lengths = np.array([
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
for data in tqdm(dataset, desc="Lengths", unit="seq")
|
|
43
|
+
self._get_length(data, input_key, label_key)
|
|
44
|
+
for data in tqdm(self.dataset, desc="Lengths", unit="seq")
|
|
31
45
|
])
|
|
32
46
|
|
|
33
47
|
tqdm.write(f"Sequence lengths computed in {time.time() - start_time:.2f} seconds.")
|
|
@@ -35,7 +49,7 @@ class SequenceLengthBatchSampler(Sampler[List[int]]):
|
|
|
35
49
|
start_time = time.time()
|
|
36
50
|
tqdm.write("Assigning buckets...")
|
|
37
51
|
|
|
38
|
-
# Assign bucket ids
|
|
52
|
+
# Assign bucket ids (0-based)
|
|
39
53
|
self.bucket_ids = np.digitize(self.lengths, bins=self.boundaries, right=True)
|
|
40
54
|
|
|
41
55
|
# Create buckets of indices
|
|
@@ -46,7 +60,6 @@ class SequenceLengthBatchSampler(Sampler[List[int]]):
|
|
|
46
60
|
start_time = time.time()
|
|
47
61
|
tqdm.write("Preparing batches...")
|
|
48
62
|
|
|
49
|
-
# Prepare batches from buckets
|
|
50
63
|
self.batches = []
|
|
51
64
|
for bucket, batch_size in zip(self.buckets, self.batch_sizes):
|
|
52
65
|
bucket = bucket.copy()
|
|
@@ -66,8 +79,26 @@ class SequenceLengthBatchSampler(Sampler[List[int]]):
|
|
|
66
79
|
self.length = len(self.batches)
|
|
67
80
|
tqdm.write(f"Batches prepared in {time.time() - start_time:.2f} seconds.")
|
|
68
81
|
|
|
82
|
+
def _get_length(self, data, input_key, label_key) -> int:
|
|
83
|
+
"""
|
|
84
|
+
Helper to get the max length of input and label sequences in a dataset item.
|
|
85
|
+
|
|
86
|
+
Supports dict-like or tuple/list-like dataset items.
|
|
87
|
+
"""
|
|
88
|
+
try:
|
|
89
|
+
if input_key is None or label_key is None:
|
|
90
|
+
# Assume tuple/list with input at 0, label at 2
|
|
91
|
+
input_seq = data[0]
|
|
92
|
+
label_seq = data[2]
|
|
93
|
+
else:
|
|
94
|
+
input_seq = data[input_key]
|
|
95
|
+
label_seq = data[label_key]
|
|
96
|
+
return max(len(input_seq), len(label_seq))
|
|
97
|
+
except Exception as e:
|
|
98
|
+
raise ValueError(f"Error accessing lengths with input_key={input_key}, label_key={label_key}: {e}")
|
|
99
|
+
|
|
69
100
|
def __iter__(self) -> Iterator[List[int]]:
|
|
70
|
-
# Shuffle
|
|
101
|
+
# Shuffle batches globally for randomness
|
|
71
102
|
np.random.shuffle(self.batches)
|
|
72
103
|
for batch in self.batches:
|
|
73
104
|
yield batch
|
|
File without changes
|
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/__pycache__/__init__.cpython-310.pyc
RENAMED
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/__pycache__/__init__.cpython-311.pyc
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
|
|
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
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/french/tfidfaug_w2idf.txt
RENAMED
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/french/tfidfaug_w2tfidf.txt
RENAMED
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/__init__.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/main_2.py
RENAMED
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/optimization.py
RENAMED
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/transformers/position.py
RENAMED
|
File without changes
|
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/wolof/tfidfaug_w2idf.txt
RENAMED
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/models/wolof/tfidfaug_w2tfidf.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/adverse_tokenizer.json
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
|
|
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
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/t5_tokenizers.zip
RENAMED
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/tokenizer_v1.json
RENAMED
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/tokenizers/tokenizer_v3_2.json
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/transformer_trainer.py
RENAMED
|
File without changes
|
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/transformer_trainer_ml.py
RENAMED
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/trainers/transformer_trainer_ml_.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
|
|
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
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/display_predictions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/extract_new_sentences.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/improvements/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/improvements/end_marks.py
RENAMED
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/recuperate_datasets.py
RENAMED
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate/utils/recuperate_datasets_trunc.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
|
|
File without changes
|
|
File without changes
|
{wolof_translate-0.0.3 → wolof_translate-0.0.4}/wolof_translate.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|