rezalatifi commited on
Commit
237509d
1 Parent(s): 65794e2

Config Files, Model, Tokenizer and README added.

Browse files
Files changed (5) hide show
  1. README.md +31 -0
  2. config.json +65 -0
  3. pytorch_model.bin +3 -0
  4. tokenizer.json +0 -0
  5. tokenizer_config.json +17 -0
README.md CHANGED
@@ -1,3 +1,34 @@
1
  ---
 
2
  license: apache-2.0
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language: fa
3
  license: apache-2.0
4
+ tags:
5
+ - Farsi
6
  ---
7
+ # Arnavāz (ارنواز)
8
+
9
+ **Model Description:** Arnavaz/gpt-arnavaz-beta is gpt2 language model that is fine-tuned using [bolbolzaban/gpt2-persian](https://huggingface.co/bolbolzaban/gpt2-persian) pretrained model.
10
+ [bolbolzaban/gpt2-persian](https://huggingface.co/bolbolzaban/gpt2-persian) has been trained similar to [gpt2-medium](https://huggingface.co/gpt2-medium) with differences in context size, tokenizer and language [(Read more)](https://medium.com/@khashei/a-not-so-dangerous-ai-in-the-persian-language-39172a641c84).
11
+ - **Developed by:** [Rezā Latifi](https://rezalatifi.ir)
12
+ - **Model Type:** Transformer-based language model
13
+ - **Language:** Persian (All characters other than the Persian alphabet are replaced with special tokens)
14
+ - **License:** [Modified MIT License](https://github.com/openai/gpt-2/blob/master/LICENSE)
15
+ - **Related Models:** [bolbolzaban/gpt2-persian](https://huggingface.co/bolbolzaban/gpt2-persian), [gpt2-medium](https://huggingface.co/gpt2-medium)
16
+ - **Resources for more information:**
17
+ - [Arnavaz Website](https://openai.com/blog/better-language-models/)
18
+
19
+ ## How to utilize
20
+ Using a pipeline for text generation, Arnavaz can be utilized like this:
21
+
22
+ ```python
23
+ from transformers import pipeline, AutoTokenizer, GPT2LMHeadModel, AutoConfig
24
+ tokenizer = AutoTokenizer.from_pretrained('Arnavaz/gpt2-arnavaz-beta')
25
+ model = GPT2LMHeadModel.from_pretrained('Arnavaz/gpt2-arnavaz-beta')
26
+ config = AutoConfig.from_pretrained('Arnavaz/gpt2-arnavaz-beta', max_length=512)
27
+ generator = pipeline('text-generation', model, tokenizer=tokenizer, config=config)
28
+
29
+ def getEloquent(ineloquent):
30
+ result = generator(f"[BOS]{ineloquent}[SEP]")[0]['generated_text']
31
+ return result[result.find('[SEP]')+5:]
32
+
33
+ sample = getEloquent('استفاده از کاغذ پاپیروس برای نوشتن کتاب از حدود دو هزار سال قبل از میلاد در مصر رایج شد.')
34
+ ```
config.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "./",
3
+ "activation_function": "gelu_new",
4
+ "architectures": [
5
+ "GPT2LMHeadModel"
6
+ ],
7
+ "attn_dropout": 0.1,
8
+ "attn_pdrop": 0.1,
9
+ "beta1": 0.9,
10
+ "beta2": 0.98,
11
+ "bos_token_id": 8,
12
+ "data_path": "",
13
+ "embd_pdrop": 0.1,
14
+ "embed_dropout": 0.1,
15
+ "eos_token_id": 9,
16
+ "epsilon": 1e-09,
17
+ "eval_batch_size": 128,
18
+ "eval_steps": 10,
19
+ "gradient_checkpointing": false,
20
+ "initializer_range": 0.02,
21
+ "iterations": 1000,
22
+ "layer_norm_epsilon": 1e-05,
23
+ "line_count": 1,
24
+ "lr": 0.00025,
25
+ "max_steps": 3600000,
26
+ "model": "GPT2",
27
+ "model_type": "gpt2",
28
+ "n_ctx": 256,
29
+ "n_embd": 1024,
30
+ "n_head": 16,
31
+ "n_inner": null,
32
+ "n_layer": 24,
33
+ "n_positions": 256,
34
+ "n_vocab": 25000,
35
+ "opt_name": "adam",
36
+ "precision": "float32",
37
+ "predict_batch_size": 8,
38
+ "reorder_and_upcast_attn": false,
39
+ "res_dropout": 0.1,
40
+ "resid_pdrop": 0.1,
41
+ "scale_attn_by_inverse_layer_idx": false,
42
+ "scale_attn_weights": true,
43
+ "scale_by_depth": true,
44
+ "scale_by_in": true,
45
+ "summary_activation": null,
46
+ "summary_first_dropout": 0.1,
47
+ "summary_proj_to_labels": true,
48
+ "summary_type": "cls_index",
49
+ "summary_use_proj": true,
50
+ "task_specific_params": {
51
+ "text-generation": {
52
+ "do_sample": true,
53
+ "max_length": 512
54
+ }
55
+ },
56
+ "tokenizer_class": "AlbertTokenizer",
57
+ "torch_dtype": "float32",
58
+ "train_batch_size": 320,
59
+ "train_steps": 10000,
60
+ "transformers_version": "4.12.3",
61
+ "use_cache": true,
62
+ "vocab_size": 25000,
63
+ "warmup_steps": 2000,
64
+ "weight_decay": 0.01
65
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1ff44b8480d9c7d23509f2d395457e77d224313d2c2a7ce6420b2a86c018953e
3
+ size 1314389977
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_lower_case": false,
3
+ "remove_space": true,
4
+ "keep_accents": true,
5
+ "bos_token": "[BOS]",
6
+ "eos_token": "[EOS]",
7
+ "unk_token": "[UNK]",
8
+ "sep_token": "[SEP]",
9
+ "pad_token": "[PAD]",
10
+ "cls_token": "[CLS]",
11
+ "mask_token": "[MSK]",
12
+ "normalizer": {
13
+ "type": "Sequence",
14
+ "normalizers": []
15
+ },
16
+ "name_or_path": "./"
17
+ }