agentlans commited on
Commit
c4471fa
·
verified ·
1 Parent(s): 933567e

Upload 3 files

Browse files
README.md CHANGED
@@ -1,3 +1,92 @@
1
  ---
 
 
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - multilingual
4
  license: apache-2.0
5
+ tags:
6
+ - tokenizer
7
+ - sentencepiece
8
+ - bpe
9
+ - multilingual
10
+ - fineweb
11
+ datasets:
12
+ - agentlans/fineweb-200-weighted
13
+ library_name: sentencepiece
14
  ---
15
+ # FineWeb 200 SentencePiece Tokenizer
16
+
17
+ A broad-coverage, 200-language SentencePiece tokenizer trained on the [`agentlans/fineweb-200-weighted`](https://huggingface.co/datasets/agentlans/fineweb-200-weighted) dataset using [Google SentencePiece](https://github.com/google/sentencepiece).
18
+
19
+ ## 🚀 Potential Use Cases
20
+
21
+ * **Cross-Lingual Analysis:** Quantify the amount and distribution of multilingual material in a language-independent manner.
22
+ * **Comparative NLP:** Study n-gram frequencies, tokenization efficiency, and linguistic compression rates across diverse language families.
23
+ * **Multilingual Probing:** Analyze vocabulary coverage and token fragmentation across low- and high-resource languages.
24
+
25
+ ## 🛠️ Training Details
26
+
27
+ The training corpus was prepared using the following preprocessing pipeline:
28
+
29
+ 1. **Normalization:** Applied NFC Unicode normalization.
30
+ 2. **Sentence Segmentation:** Split texts into individual sentences using the ICU package.
31
+ 3. **Deduplication:** Formatted as one sentence per line and deduplicated to reduce redundancy.
32
+
33
+ ### SentencePiece Configuration
34
+
35
+ ```bash
36
+ spm_train \
37
+ --input=sentences.txt \
38
+ --model_prefix=spm_200lang_bpe_64k \
39
+ --model_type=bpe \
40
+ --vocab_size=65536 \
41
+ --auto_character_coverage=true \
42
+ --byte_fallback=true \
43
+ --normalization_rule_name=identity \
44
+ --add_dummy_prefix=false \
45
+ --remove_extra_whitespaces=false \
46
+ --split_by_whitespace=true \
47
+ --split_by_unicode_script=false \
48
+ --split_by_number=false \
49
+ --split_digits=false \
50
+ --treat_whitespace_as_suffix=false \
51
+ --allow_whitespace_only_pieces=false \
52
+ --max_sentencepiece_length=128 \
53
+ --max_sentence_length=16384 \
54
+ --pad_id=3 \
55
+ --bos_id=1 \
56
+ --eos_id=2 \
57
+ --unk_id=0 \
58
+ --hard_vocab_limit=true
59
+
60
+ ```
61
+
62
+ ## 📦 Example Usage
63
+
64
+ Here is how you can load and use the tokenizer with Python:
65
+
66
+ ```python
67
+ import sentencepiece as spm
68
+
69
+ # Load the model
70
+ sp = spm.SentencePieceProcessor()
71
+ sp.load("spm_200lang_bpe_64k.model")
72
+
73
+ # Encode text into token IDs
74
+ text = "Hello, world! Bonjour le monde!"
75
+ tokens = sp.encode(text)
76
+ print("Token IDs:", tokens)
77
+
78
+ # Decode token IDs back to text
79
+ decoded_text = sp.decode(tokens)
80
+ print("Decoded:", decoded_text)
81
+
82
+ ```
83
+
84
+ ## ⚠️ Limitations
85
+
86
+ * **Generalist Trade-off:** Because it is designed to cover 200 languages, it is not optimized for maximum compression or performance on any single language or specialized domain.
87
+ * **Token Fragmentation:** Words in certain languages may be broken down into multiple subword tokens, which can impact sequence length and chunking strategies.
88
+ * **Tokenizer Only:** This repository contains only the SentencePiece tokenizer model and artifacts—it does not include a complete transformer architecture (e.g., for BERT or causal language modeling).
89
+
90
+ ## 📄 Licence
91
+
92
+ This project is licensed under the Apache 2.0 License.
spm_200lang_bpe_64k.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c4fb851d66e0262046ccd914a1c2e606112a32144b2931bbb1fb9d1a468f55e5
3
+ size 1040955
spm_200lang_bpe_64k.vocab ADDED
The diff for this file is too large to render. See raw diff