Hjgugugjhuhjggg commited on
Commit
bdd8ace
·
verified ·
1 Parent(s): a71f80f

Subida del modelo ajustado con 1 capas, hidden_size=2 y vocab_size=50259 y README.md

Browse files
README.md ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+ language: en
4
+ license: apache-2.0
5
+ tags:
6
+ - text-generation
7
+ - gpt2
8
+ library_name: transformers
9
+ pipeline_tag: text-generation
10
+ ---
11
+ # Modelo Ajustado para Generación de Texto
12
+
13
+ Este modelo ha sido ajustado a partir de `gpt2` con la siguiente configuración:
14
+
15
+ - Número de capas ocultas: 1
16
+ - Tamaño de la capa oculta: 2
17
+ - Tamaño del vocabulario: 50259
18
+
19
+ **Importante:** Este modelo utiliza la arquitectura base de `gpt2` y **ha eliminado capas internas**. El modelo original tenía 12 capas, **y ahora tiene solo 1 capa oculta**. Además, se han añadido nuevos tokens al vocabulario y sus embeddings han sido inicializados.
20
+
21
+ Se puede utilizar para tareas de generación de texto.
22
+
23
+ ## Uso
24
+
25
+ Para usar este modelo, primero debes tener instalada la librería `transformers`. Puedes instalarla usando pip:
26
+
27
+
28
+ pip install transformers
29
+
30
+
31
+ Una vez instalada, puedes cargar y usar el modelo de la siguiente manera:
32
+
33
+ from transformers import AutoModelForCausalLM, AutoTokenizer
34
+
35
+ repo_name = "lilmeaty/text-gen-example-one-layer"
36
+ model = AutoModelForCausalLM.from_pretrained(repo_name)
37
+ tokenizer = AutoTokenizer.from_pretrained(repo_name)
38
+
39
+ prompt = "Escribe una breve historia sobre un robot que aprende a amar."
40
+ input_ids = tokenizer.encode(prompt, return_tensors="pt")
41
+
42
+ output = model.generate(
43
+ input_ids,
44
+ max_length=100,
45
+ num_return_sequences=1,
46
+ no_repeat_ngram_size=2,
47
+ top_k=50,
48
+ top_p=0.95,
49
+ temperature=0.7,
50
+ do_sample=True
51
+ )
52
+
53
+ generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
54
+ print(generated_text)
55
+
added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "[SPECIAL1]": 50257,
3
+ "[SPECIAL2]": 50258
4
+ }
config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "gpt2",
3
+ "activation_function": "gelu_new",
4
+ "architectures": [
5
+ "GPT2LMHeadModel"
6
+ ],
7
+ "attn_pdrop": 0.1,
8
+ "bos_token_id": 50256,
9
+ "embd_pdrop": 0.1,
10
+ "eos_token_id": 50256,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 8,
13
+ "layer_norm_epsilon": 1e-05,
14
+ "model_type": "gpt2",
15
+ "n_ctx": 1024,
16
+ "n_embd": 2,
17
+ "n_head": 1,
18
+ "n_inner": null,
19
+ "n_layer": 1,
20
+ "n_positions": 1024,
21
+ "reorder_and_upcast_attn": false,
22
+ "resid_pdrop": 0.1,
23
+ "scale_attn_by_inverse_layer_idx": false,
24
+ "scale_attn_weights": true,
25
+ "summary_activation": null,
26
+ "summary_first_dropout": 0.1,
27
+ "summary_proj_to_labels": true,
28
+ "summary_type": "cls_index",
29
+ "summary_use_proj": true,
30
+ "task_specific_params": {
31
+ "text-generation": {
32
+ "do_sample": true,
33
+ "max_length": 50
34
+ }
35
+ },
36
+ "transformers_version": "4.47.1",
37
+ "use_cache": true,
38
+ "vocab_size": 50259
39
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 50256,
4
+ "eos_token_id": 50256,
5
+ "transformers_version": "4.47.1"
6
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ded1a55fb9c92fbed8902f0599ef164a0bf632949cedde9a3c65b83d476f7cf5
3
+ size 185900592
special_tokens_map.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ {
4
+ "content": "[SPECIAL1]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false
9
+ },
10
+ {
11
+ "content": "[SPECIAL2]",
12
+ "lstrip": false,
13
+ "normalized": false,
14
+ "rstrip": false,
15
+ "single_word": false
16
+ }
17
+ ],
18
+ "bos_token": "<|endoftext|>",
19
+ "eos_token": "<|endoftext|>",
20
+ "pad_token": "<|endoftext|>",
21
+ "unk_token": "<|endoftext|>"
22
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "50256": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": true,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "50257": {
13
+ "content": "[SPECIAL1]",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "50258": {
21
+ "content": "[SPECIAL2]",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ }
28
+ },
29
+ "additional_special_tokens": [
30
+ "[SPECIAL1]",
31
+ "[SPECIAL2]"
32
+ ],
33
+ "bos_token": "<|endoftext|>",
34
+ "clean_up_tokenization_spaces": false,
35
+ "eos_token": "<|endoftext|>",
36
+ "extra_special_tokens": {},
37
+ "model_max_length": 1024,
38
+ "pad_token": "<|endoftext|>",
39
+ "tokenizer_class": "GPT2Tokenizer",
40
+ "unk_token": "<|endoftext|>"
41
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff