ahmet1338 redrussianarmy commited on
Commit
f1a0ec9
0 Parent(s):

Duplicate from redrussianarmy/gpt2-turkish-cased

Browse files

Co-authored-by: Hakan Boğan <redrussianarmy@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
2
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.h5 filter=lfs diff=lfs merge=lfs -text
5
+ *.tflite filter=lfs diff=lfs merge=lfs -text
6
+ *.tar.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.ot filter=lfs diff=lfs merge=lfs -text
8
+ *.onnx filter=lfs diff=lfs merge=lfs -text
9
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ Pipfile
2
+ Pipfile.lock
README.md ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: "tr"
3
+ tags:
4
+ - turkish
5
+ - tr
6
+ - gpt2-tr
7
+ - gpt2-turkish
8
+ ---
9
+ # 🇹🇷 Turkish GPT-2 Model
10
+
11
+ In this repository I release GPT-2 model, that was trained on various texts for Turkish.
12
+
13
+ The model is meant to be an entry point for fine-tuning on other texts.
14
+
15
+ ## Training corpora
16
+
17
+ I used a Turkish corpora that is taken from oscar-corpus.
18
+
19
+ It was possible to create byte-level BPE with Tokenizers library of Huggingface.
20
+
21
+ With the Tokenizers library, I created a 52K byte-level BPE vocab based on the training corpora.
22
+
23
+ After creating the vocab, I could train the GPT-2 for Turkish on two 2080TI over the complete training corpus (five epochs).
24
+
25
+ Logs during training:
26
+ https://tensorboard.dev/experiment/3AWKv8bBTaqcqZP5frtGkw/#scalars
27
+
28
+ ## Model weights
29
+
30
+ Both PyTorch and Tensorflow compatible weights are available.
31
+
32
+ | Model | Downloads
33
+ | --------------------------------- | ---------------------------------------------------------------------------------------------------------------
34
+ | `redrussianarmy/gpt2-turkish-cased` | [`config.json`](https://huggingface.co/redrussianarmy/gpt2-turkish-cased/resolve/main/config.json) • [`merges.txt`](https://huggingface.co/redrussianarmy/gpt2-turkish-cased/resolve/main/merges.txt) • [`pytorch_model.bin`](https://huggingface.co/redrussianarmy/gpt2-turkish-cased/resolve/main/pytorch_model.bin) • [`special_tokens_map.json`](https://huggingface.co/redrussianarmy/gpt2-turkish-cased/resolve/main/special_tokens_map.json) • [`tf_model.h5`](https://huggingface.co/redrussianarmy/gpt2-turkish-cased/resolve/main/tf_model.h5) • [`tokenizer_config.json`](https://huggingface.co/redrussianarmy/gpt2-turkish-cased/resolve/main/tokenizer_config.json) • [`traning_args.bin`](https://huggingface.co/redrussianarmy/gpt2-turkish-cased/resolve/main/training_args.bin) • [`vocab.json`](https://huggingface.co/redrussianarmy/gpt2-turkish-cased/resolve/main/vocab.json)
35
+
36
+ ## Using the model
37
+
38
+ The model itself can be used in this way:
39
+
40
+ ``` python
41
+ from transformers import AutoTokenizer, AutoModelWithLMHead
42
+ tokenizer = AutoTokenizer.from_pretrained("redrussianarmy/gpt2-turkish-cased")
43
+ model = AutoModelWithLMHead.from_pretrained("redrussianarmy/gpt2-turkish-cased")
44
+ ```
45
+
46
+ Here's an example that shows how to use the great Transformers Pipelines for generating text:
47
+
48
+ ``` python
49
+ from transformers import pipeline
50
+ pipe = pipeline('text-generation', model="redrussianarmy/gpt2-turkish-cased",
51
+ tokenizer="redrussianarmy/gpt2-turkish-cased", config={'max_length':800})
52
+ text = pipe("Akşamüstü yolda ilerlerken, ")[0]["generated_text"]
53
+ print(text)
54
+ ```
55
+
56
+ ### How to clone the model repo?
57
+ ```
58
+ git lfs install
59
+ git clone https://huggingface.co/redrussianarmy/gpt2-turkish-cased
60
+ ```
61
+
62
+ ## Contact (Bugs, Feedback, Contribution and more)
63
+ For questions about the GPT2-Turkish model, just open an issue [here](https://github.com/redrussianarmy/gpt2-turkish/issues) 🤗
config.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_function": "gelu_new",
3
+ "architectures": [
4
+ "GPT2LMHeadModel"
5
+ ],
6
+ "attn_pdrop": 0.1,
7
+ "bos_token_id": 50256,
8
+ "embd_pdrop": 0.1,
9
+ "eos_token_id": 50256,
10
+ "gradient_checkpointing": false,
11
+ "initializer_range": 0.02,
12
+ "layer_norm_epsilon": 1e-05,
13
+ "model_type": "gpt2",
14
+ "n_ctx": 1024,
15
+ "n_embd": 768,
16
+ "n_head": 12,
17
+ "n_inner": null,
18
+ "n_layer": 12,
19
+ "n_positions": 1024,
20
+ "resid_pdrop": 0.1,
21
+ "summary_activation": null,
22
+ "summary_first_dropout": 0.1,
23
+ "summary_proj_to_labels": true,
24
+ "summary_type": "cls_index",
25
+ "summary_use_proj": true,
26
+ "task_specific_params": {
27
+ "text-generation": {
28
+ "do_sample": true,
29
+ "max_length": 50
30
+ }
31
+ },
32
+ "vocab_size": 50257
33
+ }
flax_model.msgpack ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe376584de6c19ca333b41c2cf0fdd688737edb81dfe42f57a66db2232aa957b
3
+ size 497764120
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
metadata.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "tags":[
3
+ "tr",
4
+ "turkish",
5
+ "gpt2-tr",
6
+ "gpt2-turkish"
7
+ ],
8
+ "languages":[
9
+ "tr"
10
+ ]
11
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1c11264d48e8078c36f9decc41eff62fd905111237e2cd7d60651d9f94bb946f
3
+ size 510406550
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"bos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "eos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "unk_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}}
tf_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a4723564f63bbf7b892a5f305a7da2f615d61664796d8429bb82938eeea441f
3
+ size 497933648
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"errors": "replace", "unk_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "bos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "eos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "add_prefix_space": false, "model_max_length": 1024, "special_tokens_map_file": null, "tokenizer_file": null, "name_or_path": "tokenized_data/"}
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f98dfdf111b52ba132eacb3565fd61dc1529f62b170c6ff6ed7fe5fee33eb501
3
+ size 1775
vocab.json ADDED
The diff for this file is too large to render. See raw diff