Fiste commited on
Commit
a422a6d
·
verified ·
1 Parent(s): d935595

Rakshya 0.2: card, code and licences

Browse files
Files changed (3) hide show
  1. LICENSE.md +14 -0
  2. NOTICE.md +54 -0
  3. README.md +72 -0
LICENSE.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Licences
2
+
3
+ The files `onnx/model.onnx`, `model.safetensors`, `config.json`, `tokenizer.json`, `tokenizer_config.json` and
4
+ `tagger.json` are the server model of Rakshya. Copyright (c) 2026 Fiste AI. They are licensed under the Creative
5
+ Commons Attribution-NonCommercial 4.0 International licence (CC BY-NC 4.0):
6
+ https://creativecommons.org/licenses/by-nc/4.0/legalcode
7
+
8
+ In short, and without replacing the licence text: you may use, share and adapt the model for non-commercial
9
+ purposes, with credit to "Rakshya by Fiste AI" and a link to https://huggingface.co/fiste-ai/rakshya-server.
10
+
11
+ The model learned from data, and is fine-tuned from a model, that keep their own terms. See `NOTICE.md`. Some of
12
+ that data is for non-commercial or research use only, so there is no commercial licence for this version.
13
+
14
+ The code that runs the model is at https://github.com/fiste-ai/rakshya under the MIT License.
NOTICE.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Third-party notices
2
+
3
+ ## The model
4
+
5
+ The server model of Rakshya is fine-tuned from XLM-RoBERTa base by Facebook AI (https://huggingface.co/FacebookAI/xlm-roberta-base). That model is released under the MIT License, and the notice below stays with copies and substantial portions of it.
6
+
7
+ MIT License
8
+
9
+ Copyright (c) Facebook, Inc. and its affiliates.
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
12
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation
13
+ the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
14
+ to permit persons to whom the Software is furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of
17
+ the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
20
+ THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
22
+ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23
+ IN THE SOFTWARE.
24
+
25
+ ## Training data
26
+
27
+ Rakshya was trained on text made up by a generator of ours, in which every person, number and address is invented,
28
+ and on the public sets below. None of them is redistributed here. Two are for non-commercial use and one is for
29
+ research use, which is why the Rakshya weights are non-commercial.
30
+
31
+ | Set | Language | Terms |
32
+ |---|---|---|
33
+ | EverestNER (Niraula and Chapagain, 2022), https://github.com/nowalab/everest-ner | Nepali | non-commercial; commercial use needs the permission of its authors |
34
+ | DanfeNER (Niraula and Chapagain, 2023) | Nepali | non-commercial |
35
+ | IndicPHI, https://huggingface.co/datasets/Sidharth1743/indicphi | Nepali, Hindi, English | MIT |
36
+ | HiNER (Murthy and others, 2022), https://huggingface.co/datasets/cfilt/HiNER-original | Hindi | CC BY-SA 4.0 |
37
+ | CoNLL-2003 (Tjong Kim Sang and De Meulder, 2003) | English | Reuters text, for research use |
38
+ | Few-NERD (Ding and others, 2021) | English | CC BY-SA 4.0 |
39
+ | WNUT-17 (Derczynski and others, 2017) | English | CC BY 4.0 |
40
+ | Broad Twitter Corpus (Derczynski and others, 2016) | English | CC BY 4.0 |
41
+ | Text Anonymization Benchmark (Pilán and others, 2022) | English | MIT |
42
+ | Nemotron-PII, https://huggingface.co/datasets/nvidia/Nemotron-PII | English | CC BY 4.0 |
43
+ | Maskara, https://huggingface.co/datasets/somukandula/maskara-indian-pii-200k | English, Hindi | MIT |
44
+
45
+ Sentences of EverestNER, DanfeNER and HiNER were also used a second time with the names of foreign people and
46
+ places put in, taken from ParaNames (https://github.com/bltlab/paranames, built from Wikidata), and sentences of
47
+ EverestNER and DanfeNER a third time rewritten in Latin letters.
48
+
49
+ The generator takes the names of provinces, districts and local levels from nepali-canonical
50
+ (https://github.com/ritushishir/nepali-canonical), licensed under CC BY 4.0.
51
+
52
+ ## Code
53
+
54
+ The code that runs the model is at https://github.com/fiste-ai/rakshya under the MIT License; its notices are there.
README.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ne
4
+ - en
5
+ - hi
6
+ license: cc-by-nc-4.0
7
+ library_name: onnx
8
+ pipeline_tag: token-classification
9
+ base_model: FacebookAI/xlm-roberta-base
10
+ tags:
11
+ - token-classification
12
+ - named-entity-recognition
13
+ - pii
14
+ - pii-detection
15
+ - privacy
16
+ - redaction
17
+ - anonymization
18
+ - nepali
19
+ - romanized-nepali
20
+ - devanagari
21
+ - english
22
+ - onnx
23
+ - rakshya
24
+ - fiste-ai
25
+ metrics:
26
+ - f1
27
+ ---
28
+
29
+ # Rakshya server (रक्षा)
30
+
31
+ **The large model of [Rakshya](https://huggingface.co/fiste-ai/rakshya): personal data found in Nepali and English text, for servers. By [Fiste AI](https://fiste-ai.github.io/rakshya/).** It has the rules, the 21 labels and the code of the small model, with 278 million weights in place of 40 million. Use the small one in a web page or on a phone, and this one where 1.1 GB and a few tens of milliseconds a sentence are no trouble.
32
+
33
+ ## Benchmark
34
+
35
+ 882 real texts in seven test sets that no system had seen: news, web pages, government pages and comments. The number is the F1 of exact spans over every kind of personal data in a set. Higher is better.
36
+
37
+ | System | Weights | News (ne) | Web (ne) | Government (ne) | Comments (ne, Latin) | News (en) | Web (en) | News (hi) | Mean |
38
+ |---|---|---|---|---|---|---|---|---|---|
39
+ | **[Rakshya 0.2](https://huggingface.co/fiste-ai/rakshya)** | 40M | **0.878** | 0.802 | 0.731 | **0.529** | 0.803 | 0.703 | **0.804** | 0.750 |
40
+ | **[Rakshya 0.2 server](https://huggingface.co/fiste-ai/rakshya-server)** | 278M | 0.870 | **0.815** | **0.740** | 0.520 | **0.813** | **0.740** | 0.800 | **0.757** |
41
+ | [Gopya 0.1](https://huggingface.co/fiste-ai/rakshya/tree/v0.1) | 34M | 0.855 | 0.683 | 0.636 | 0.233 | 0.729 | 0.563 | 0.725 | 0.632 |
42
+ | [EU PII anonymisation](https://huggingface.co/bardsai/eu-pii-anonimization-multilang) (bards.ai) | 278M | 0.647 | 0.601 | 0.409 | 0.253 | 0.787 | 0.530 | 0.727 | 0.565 |
43
+ | [XLM-R base NER HRL](https://huggingface.co/Davlan/xlm-roberta-base-ner-hrl) (Davlan) | 277M | 0.660 | 0.617 | 0.267 | 0.302 | 0.772 | 0.498 | 0.712 | 0.547 |
44
+ | [XLM-R large, CoNLL-2003](https://huggingface.co/FacebookAI/xlm-roberta-large-finetuned-conll03-english) (FacebookAI) | 559M | 0.651 | 0.574 | 0.200 | 0.265 | 0.783 | 0.481 | 0.760 | 0.531 |
45
+ | [EU PII anonymisation v3](https://huggingface.co/bardsai/eu-pii-anonimization-multilang-v3) (bards.ai) | 308M | 0.144 | 0.704 | 0.328 | 0.162 | 0.605 | 0.709 | 0.528 | 0.454 |
46
+ | [Nym PII multilingual](https://huggingface.co/Wismut/nym-pii-multilingual) (Wismut) | 308M | 0.427 | 0.420 | 0.301 | 0.252 | 0.655 | 0.478 | 0.595 | 0.447 |
47
+
48
+ None of the 25 published systems we ran scores higher than Rakshya 0.2 server on any of the seven sets.
49
+
50
+ All 25 systems, the scores by kind, the false alarms and the method are in the [full benchmark](https://github.com/fiste-ai/rakshya/blob/main/BENCHMARK.md).
51
+
52
+ ## Use it
53
+
54
+ ```python
55
+ # pip install git+https://github.com/fiste-ai/rakshya
56
+ from rakshya import Rakshya
57
+
58
+ pii = Rakshya(model="server") # fetches this model once, 1.1 GB
59
+ pii.redact("मेरो नाम सीता थापा हो, फोन ९८४१२३४५६७।")
60
+ ```
61
+
62
+ From a shell: `rakshya --server "some text"`. On a processor it reads a sentence of about 21 tokens in 40 ms on one thread and 15 ms on four (a laptop processor, Intel Core i5-13420H). With `onnxruntime-gpu` installed, `Rakshya(model="server", providers=["CUDAExecutionProvider"])` runs it on a graphics card.
63
+
64
+ The repository also loads as a plain token classifier in `transformers`. Read that way the model gives its tags alone: the rules and the cut at the case marker are in the package.
65
+
66
+ The scores above were measured with these weights on a graphics card. The ONNX file here holds the same weights and gives the same tag on 10,259 of 10,259 tokens of a check.
67
+
68
+ ## Limits
69
+
70
+ The limits of the small model hold here too: it is a helper and not a guarantee, Nepali in Latin letters is the hardest, Hindi is experimental, and identity numbers are tested mostly on made-up text. See the [card of the small model](https://huggingface.co/fiste-ai/rakshya#limits).
71
+
72
+ Weights CC BY-NC 4.0, code MIT; see `LICENSE.md` and `NOTICE.md`. Part of the training data is for non-commercial use, so there is no commercial licence for this version. Questions: [contact us](https://fiste-ai.github.io/contact/).