Upload 109 files
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- abilities/inference.py +33 -0
- abilities/small/checkpoint-1000/config.json +39 -0
- abilities/small/checkpoint-1000/generation_config.json +6 -0
- abilities/small/checkpoint-1000/model.safetensors +3 -0
- abilities/small/checkpoint-1000/optimizer.pt +3 -0
- abilities/small/checkpoint-1000/rng_state.pth +3 -0
- abilities/small/checkpoint-1000/scheduler.pt +3 -0
- abilities/small/checkpoint-1000/trainer_state.json +0 -0
- abilities/small/checkpoint-1000/training_args.bin +3 -0
- abilities/small/checkpoint-2000/config.json +39 -0
- abilities/small/checkpoint-2000/generation_config.json +6 -0
- abilities/small/checkpoint-2000/model.safetensors +3 -0
- abilities/small/checkpoint-2000/optimizer.pt +3 -0
- abilities/small/checkpoint-2000/rng_state.pth +3 -0
- abilities/small/checkpoint-2000/scheduler.pt +3 -0
- abilities/small/checkpoint-2000/trainer_state.json +0 -0
- abilities/small/checkpoint-2000/training_args.bin +3 -0
- abilities/small/checkpoint-3000/config.json +39 -0
- abilities/small/checkpoint-3000/generation_config.json +6 -0
- abilities/small/checkpoint-3000/model.safetensors +3 -0
- abilities/small/checkpoint-3000/optimizer.pt +3 -0
- abilities/small/checkpoint-3000/rng_state.pth +3 -0
- abilities/small/checkpoint-3000/scheduler.pt +3 -0
- abilities/small/checkpoint-3000/trainer_state.json +0 -0
- abilities/small/checkpoint-3000/training_args.bin +3 -0
- abilities/small/checkpoint-4000/config.json +39 -0
- abilities/small/checkpoint-4000/generation_config.json +6 -0
- abilities/small/checkpoint-4000/model.safetensors +3 -0
- abilities/small/checkpoint-4000/optimizer.pt +3 -0
- abilities/small/checkpoint-4000/rng_state.pth +3 -0
- abilities/small/checkpoint-4000/scheduler.pt +3 -0
- abilities/small/checkpoint-4000/trainer_state.json +0 -0
- abilities/small/checkpoint-4000/training_args.bin +3 -0
- abilities/small/checkpoint-5000/config.json +39 -0
- abilities/small/checkpoint-5000/generation_config.json +6 -0
- abilities/small/checkpoint-5000/model.safetensors +3 -0
- abilities/small/checkpoint-5000/optimizer.pt +3 -0
- abilities/small/checkpoint-5000/rng_state.pth +3 -0
- abilities/small/checkpoint-5000/scheduler.pt +3 -0
- abilities/small/checkpoint-5000/trainer_state.json +0 -0
- abilities/small/checkpoint-5000/training_args.bin +3 -0
- abilities/small/config.json +39 -0
- abilities/small/generation_config.json +6 -0
- abilities/small/merges.txt +0 -0
- abilities/small/model.safetensors +3 -0
- abilities/small/special_tokens_map.json +24 -0
- abilities/small/tokenizer_config.json +22 -0
- abilities/small/vocab.json +0 -0
- abilities/train-small.py +78 -0
- midjourney/inference.py +33 -0
abilities/inference.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import random
|
| 3 |
+
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
| 4 |
+
|
| 5 |
+
model = GPT2LMHeadModel.from_pretrained("v2/abilities/small")
|
| 6 |
+
tokenizer = GPT2Tokenizer.from_pretrained("v2/abilities/small")
|
| 7 |
+
model.resize_token_embeddings(len(tokenizer))
|
| 8 |
+
|
| 9 |
+
device = torch.device("cpu")
|
| 10 |
+
|
| 11 |
+
# test examples
|
| 12 |
+
#input_text = "Marie Simmons, a dedicated librarian at the New York Public Library, was exploring the depths of the ancient manuscripts section when she stumbled upon an old, mysterious book emitting a faint, mystic glow. As she opened the cryptic pages, a burst of ancient energy enveloped her, unlocking hidden archeological knowledge and skills. The transformation was dramatic and instilled her with the agility and intellect of a seasoned archeologist adventurer. Now, Marie could decipher any historical artifact, navigate through perilous ruins with ease, and uncover secrets locked for millennia. Her life as a librarian took a thrilling turn into adventures, unearthing artifacts that could tell humanity's untold stories. Her daily routine of categorizing led her to categorize the relics of history to solve age-old mysteries.<|endoftext|>"
|
| 13 |
+
input_text = "It was an ordinary Thursday at interparkways where Ethan Cooper sat intensely focused on solving the complex cybercrime cases that surrounded him. As he rallied his team to identify and neutralize potential threats within miles of downtow elatri to each case. sa dicance suddenly clicked for evansas ithe coe itselfend aered teed gnation manipulaten behaviors consistent with heightened instinctual understanding. Suddenly: Reckless! flashed before his eyes raw intelligence cascaded no t just into actionable insights but also into boldness like watching sharp-shooting sequences in slow motion unfoldstrobbing situatio ns. With this convergence Ethereum became more than a cybersecurity expert; it transformed one elite intersectional hacker identity i nto something far beyond a mere analyst.? Ever since then Carl had become no longer merelyan cypher for justices sake ?he emergedint o existenceiriderously coiningthedigitalpuzzle unlike any other yetinelinformaticaurel.<|endoftext|>"
|
| 14 |
+
|
| 15 |
+
input_ids = tokenizer.encode(input_text, return_tensors="pt").to("cpu")
|
| 16 |
+
|
| 17 |
+
output = model.generate(
|
| 18 |
+
input_ids,
|
| 19 |
+
max_length=400,
|
| 20 |
+
num_return_sequences=1,
|
| 21 |
+
eos_token_id=tokenizer.eos_token_id,
|
| 22 |
+
repetition_penalty=2.0,
|
| 23 |
+
#top_k=200,
|
| 24 |
+
#top_p=0.9,
|
| 25 |
+
num_beams=5,
|
| 26 |
+
#temperature=1.0, #0.7
|
| 27 |
+
do_sample=True,
|
| 28 |
+
use_cache=True,
|
| 29 |
+
#output also special tokens
|
| 30 |
+
output_hidden_states=True,
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
print("\n", tokenizer.decode(output[0], skip_special_tokens=False), "\n\n", "Answer took", len(output[0]), "tokens\n")
|
abilities/small/checkpoint-1000/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 |
+
"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 |
+
"reorder_and_upcast_attn": false,
|
| 21 |
+
"resid_pdrop": 0.1,
|
| 22 |
+
"scale_attn_by_inverse_layer_idx": false,
|
| 23 |
+
"scale_attn_weights": true,
|
| 24 |
+
"summary_activation": null,
|
| 25 |
+
"summary_first_dropout": 0.1,
|
| 26 |
+
"summary_proj_to_labels": true,
|
| 27 |
+
"summary_type": "cls_index",
|
| 28 |
+
"summary_use_proj": true,
|
| 29 |
+
"task_specific_params": {
|
| 30 |
+
"text-generation": {
|
| 31 |
+
"do_sample": true,
|
| 32 |
+
"max_length": 50
|
| 33 |
+
}
|
| 34 |
+
},
|
| 35 |
+
"torch_dtype": "float32",
|
| 36 |
+
"transformers_version": "4.43.4",
|
| 37 |
+
"use_cache": true,
|
| 38 |
+
"vocab_size": 50257
|
| 39 |
+
}
|
abilities/small/checkpoint-1000/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.43.4"
|
| 6 |
+
}
|
abilities/small/checkpoint-1000/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8010d0c94d08f5dfe64670385b7872b665aba3f95cfb3b7e28a0f7c15b05cebf
|
| 3 |
+
size 497774208
|
abilities/small/checkpoint-1000/optimizer.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:132187cfab29508511a6a240bbc1c98989b806b161a1a3a284c92f982b3baa3a
|
| 3 |
+
size 995638202
|
abilities/small/checkpoint-1000/rng_state.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3841156cd8929793cbd7fb332a3240de72f83da489e8c6d2ba0311870bbd39cd
|
| 3 |
+
size 13990
|
abilities/small/checkpoint-1000/scheduler.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2cf95d737c502f08278f8c5ca733a4f1eb654c1a061db1faaeaa5ebac0fe4f81
|
| 3 |
+
size 1064
|
abilities/small/checkpoint-1000/trainer_state.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
abilities/small/checkpoint-1000/training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:528211fba6b7ff722adfc5f4eb4bd3b8328180e87f53634715788db3352773a1
|
| 3 |
+
size 5176
|
abilities/small/checkpoint-2000/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 |
+
"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 |
+
"reorder_and_upcast_attn": false,
|
| 21 |
+
"resid_pdrop": 0.1,
|
| 22 |
+
"scale_attn_by_inverse_layer_idx": false,
|
| 23 |
+
"scale_attn_weights": true,
|
| 24 |
+
"summary_activation": null,
|
| 25 |
+
"summary_first_dropout": 0.1,
|
| 26 |
+
"summary_proj_to_labels": true,
|
| 27 |
+
"summary_type": "cls_index",
|
| 28 |
+
"summary_use_proj": true,
|
| 29 |
+
"task_specific_params": {
|
| 30 |
+
"text-generation": {
|
| 31 |
+
"do_sample": true,
|
| 32 |
+
"max_length": 50
|
| 33 |
+
}
|
| 34 |
+
},
|
| 35 |
+
"torch_dtype": "float32",
|
| 36 |
+
"transformers_version": "4.43.4",
|
| 37 |
+
"use_cache": true,
|
| 38 |
+
"vocab_size": 50257
|
| 39 |
+
}
|
abilities/small/checkpoint-2000/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.43.4"
|
| 6 |
+
}
|
abilities/small/checkpoint-2000/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b96f2ff64aef95f606e185f40bfe7dcbcf90e37678d06740d9bcda51001fb135
|
| 3 |
+
size 497774208
|
abilities/small/checkpoint-2000/optimizer.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a4d30ad93de493e532abbf71d621e1ce74852345fb07e32ea198dbf36a2e5bd9
|
| 3 |
+
size 995638202
|
abilities/small/checkpoint-2000/rng_state.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:03a86aa35e4a92a2deafb4630a56fafb1bf1f09aa4906a088cf83eaf82439988
|
| 3 |
+
size 13990
|
abilities/small/checkpoint-2000/scheduler.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:08d5207ccc2ec1bf528fd726743d90f1690c9bf5f99a049e4fbc7019bb0c4d13
|
| 3 |
+
size 1064
|
abilities/small/checkpoint-2000/trainer_state.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
abilities/small/checkpoint-2000/training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:528211fba6b7ff722adfc5f4eb4bd3b8328180e87f53634715788db3352773a1
|
| 3 |
+
size 5176
|
abilities/small/checkpoint-3000/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 |
+
"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 |
+
"reorder_and_upcast_attn": false,
|
| 21 |
+
"resid_pdrop": 0.1,
|
| 22 |
+
"scale_attn_by_inverse_layer_idx": false,
|
| 23 |
+
"scale_attn_weights": true,
|
| 24 |
+
"summary_activation": null,
|
| 25 |
+
"summary_first_dropout": 0.1,
|
| 26 |
+
"summary_proj_to_labels": true,
|
| 27 |
+
"summary_type": "cls_index",
|
| 28 |
+
"summary_use_proj": true,
|
| 29 |
+
"task_specific_params": {
|
| 30 |
+
"text-generation": {
|
| 31 |
+
"do_sample": true,
|
| 32 |
+
"max_length": 50
|
| 33 |
+
}
|
| 34 |
+
},
|
| 35 |
+
"torch_dtype": "float32",
|
| 36 |
+
"transformers_version": "4.43.4",
|
| 37 |
+
"use_cache": true,
|
| 38 |
+
"vocab_size": 50257
|
| 39 |
+
}
|
abilities/small/checkpoint-3000/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.43.4"
|
| 6 |
+
}
|
abilities/small/checkpoint-3000/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:221e01e8f6bcd47753c3af6b6219ba00485d27c06600d0d1c8e29145a1d99a04
|
| 3 |
+
size 497774208
|
abilities/small/checkpoint-3000/optimizer.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7530db8decc2b5ed1c923aea1669c331319c7eb92bb96f8e2442135a9dbe9726
|
| 3 |
+
size 995638202
|
abilities/small/checkpoint-3000/rng_state.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c55f3587e0f5cc006a362b2c53d4e627aba534c6c3c64d6cd13c40274ce40327
|
| 3 |
+
size 13990
|
abilities/small/checkpoint-3000/scheduler.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e4e6f86ea4562b7b04b0c050953399808976cf73d9bb029a4d618da11bdaadee
|
| 3 |
+
size 1064
|
abilities/small/checkpoint-3000/trainer_state.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
abilities/small/checkpoint-3000/training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:528211fba6b7ff722adfc5f4eb4bd3b8328180e87f53634715788db3352773a1
|
| 3 |
+
size 5176
|
abilities/small/checkpoint-4000/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 |
+
"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 |
+
"reorder_and_upcast_attn": false,
|
| 21 |
+
"resid_pdrop": 0.1,
|
| 22 |
+
"scale_attn_by_inverse_layer_idx": false,
|
| 23 |
+
"scale_attn_weights": true,
|
| 24 |
+
"summary_activation": null,
|
| 25 |
+
"summary_first_dropout": 0.1,
|
| 26 |
+
"summary_proj_to_labels": true,
|
| 27 |
+
"summary_type": "cls_index",
|
| 28 |
+
"summary_use_proj": true,
|
| 29 |
+
"task_specific_params": {
|
| 30 |
+
"text-generation": {
|
| 31 |
+
"do_sample": true,
|
| 32 |
+
"max_length": 50
|
| 33 |
+
}
|
| 34 |
+
},
|
| 35 |
+
"torch_dtype": "float32",
|
| 36 |
+
"transformers_version": "4.43.4",
|
| 37 |
+
"use_cache": true,
|
| 38 |
+
"vocab_size": 50257
|
| 39 |
+
}
|
abilities/small/checkpoint-4000/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.43.4"
|
| 6 |
+
}
|
abilities/small/checkpoint-4000/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:093901c82a9d937ec7882abe3782654ca310f5f6ce249e64599be46c162dd644
|
| 3 |
+
size 497774208
|
abilities/small/checkpoint-4000/optimizer.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:25d7d56d484ca415fc52a1284c7e656e1206bfd38477b81b94b3700c20607da0
|
| 3 |
+
size 995638202
|
abilities/small/checkpoint-4000/rng_state.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cb0115dddb0319352aedefea8ba819657d88f4791e61497b29994773a8d0450f
|
| 3 |
+
size 13990
|
abilities/small/checkpoint-4000/scheduler.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:78acb8d4deec990a5d90e2372237db01a785bde1bb7790eeb4fc31ef2d93d016
|
| 3 |
+
size 1064
|
abilities/small/checkpoint-4000/trainer_state.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
abilities/small/checkpoint-4000/training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:528211fba6b7ff722adfc5f4eb4bd3b8328180e87f53634715788db3352773a1
|
| 3 |
+
size 5176
|
abilities/small/checkpoint-5000/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 |
+
"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 |
+
"reorder_and_upcast_attn": false,
|
| 21 |
+
"resid_pdrop": 0.1,
|
| 22 |
+
"scale_attn_by_inverse_layer_idx": false,
|
| 23 |
+
"scale_attn_weights": true,
|
| 24 |
+
"summary_activation": null,
|
| 25 |
+
"summary_first_dropout": 0.1,
|
| 26 |
+
"summary_proj_to_labels": true,
|
| 27 |
+
"summary_type": "cls_index",
|
| 28 |
+
"summary_use_proj": true,
|
| 29 |
+
"task_specific_params": {
|
| 30 |
+
"text-generation": {
|
| 31 |
+
"do_sample": true,
|
| 32 |
+
"max_length": 50
|
| 33 |
+
}
|
| 34 |
+
},
|
| 35 |
+
"torch_dtype": "float32",
|
| 36 |
+
"transformers_version": "4.43.4",
|
| 37 |
+
"use_cache": true,
|
| 38 |
+
"vocab_size": 50257
|
| 39 |
+
}
|
abilities/small/checkpoint-5000/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.43.4"
|
| 6 |
+
}
|
abilities/small/checkpoint-5000/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f61cb295fc6bed0d04e8a9319686efa6dd9d0d9c8b1046d57c64cda7c0fba713
|
| 3 |
+
size 497774208
|
abilities/small/checkpoint-5000/optimizer.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:712eb860284d1f8206981319e7da873be2b1e0eff8d0904193b4f9554c4510f6
|
| 3 |
+
size 995638202
|
abilities/small/checkpoint-5000/rng_state.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:598a2fa6f69bc4deff64311686964f1c3cbf7b25cd67c1cb13e8602e3b3ea772
|
| 3 |
+
size 13990
|
abilities/small/checkpoint-5000/scheduler.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1b9eb8a93f430c8604da9d0e44af3157d30210ee40b9e8edd66112bb06a5c0d7
|
| 3 |
+
size 1064
|
abilities/small/checkpoint-5000/trainer_state.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
abilities/small/checkpoint-5000/training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:528211fba6b7ff722adfc5f4eb4bd3b8328180e87f53634715788db3352773a1
|
| 3 |
+
size 5176
|
abilities/small/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 |
+
"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 |
+
"reorder_and_upcast_attn": false,
|
| 21 |
+
"resid_pdrop": 0.1,
|
| 22 |
+
"scale_attn_by_inverse_layer_idx": false,
|
| 23 |
+
"scale_attn_weights": true,
|
| 24 |
+
"summary_activation": null,
|
| 25 |
+
"summary_first_dropout": 0.1,
|
| 26 |
+
"summary_proj_to_labels": true,
|
| 27 |
+
"summary_type": "cls_index",
|
| 28 |
+
"summary_use_proj": true,
|
| 29 |
+
"task_specific_params": {
|
| 30 |
+
"text-generation": {
|
| 31 |
+
"do_sample": true,
|
| 32 |
+
"max_length": 50
|
| 33 |
+
}
|
| 34 |
+
},
|
| 35 |
+
"torch_dtype": "float32",
|
| 36 |
+
"transformers_version": "4.43.4",
|
| 37 |
+
"use_cache": true,
|
| 38 |
+
"vocab_size": 50257
|
| 39 |
+
}
|
abilities/small/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.43.4"
|
| 6 |
+
}
|
abilities/small/merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
abilities/small/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f61cb295fc6bed0d04e8a9319686efa6dd9d0d9c8b1046d57c64cda7c0fba713
|
| 3 |
+
size 497774208
|
abilities/small/special_tokens_map.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<|endoftext|>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": true,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "<|endoftext|>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": true,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": "<|endoftext|>",
|
| 17 |
+
"unk_token": {
|
| 18 |
+
"content": "<|endoftext|>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": true,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
}
|
| 24 |
+
}
|
abilities/small/tokenizer_config.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": false,
|
| 3 |
+
"add_prefix_space": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"50256": {
|
| 6 |
+
"content": "<|endoftext|>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": true,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
}
|
| 13 |
+
},
|
| 14 |
+
"bos_token": "<|endoftext|>",
|
| 15 |
+
"clean_up_tokenization_spaces": true,
|
| 16 |
+
"eos_token": "<|endoftext|>",
|
| 17 |
+
"errors": "replace",
|
| 18 |
+
"model_max_length": 1024,
|
| 19 |
+
"pad_token": "<|endoftext|>",
|
| 20 |
+
"tokenizer_class": "GPT2Tokenizer",
|
| 21 |
+
"unk_token": "<|endoftext|>"
|
| 22 |
+
}
|
abilities/small/vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
abilities/train-small.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import torch
|
| 3 |
+
from torch.utils.data import Dataset
|
| 4 |
+
from transformers import GPT2Tokenizer, GPT2LMHeadModel, Trainer, TrainingArguments
|
| 5 |
+
|
| 6 |
+
os.environ["PYTORCH_MPS_HIGH_WATERMARK_RATIO"]="0.0"
|
| 7 |
+
|
| 8 |
+
class StoryAbilitiesDataset(Dataset):
|
| 9 |
+
def __init__(self, file_path, tokenizer, block_size=256):
|
| 10 |
+
self.examples = []
|
| 11 |
+
with open(file_path, 'r', encoding='utf-8', errors='replace') as f:
|
| 12 |
+
text = f.read()
|
| 13 |
+
|
| 14 |
+
lines = text.splitlines()
|
| 15 |
+
print1 = True
|
| 16 |
+
for line in lines:
|
| 17 |
+
if line.strip():
|
| 18 |
+
parts = line.split('<|endoftext|>')
|
| 19 |
+
if len(parts) > 1:
|
| 20 |
+
story_part = parts[1].split('[PAD]')
|
| 21 |
+
|
| 22 |
+
if len(story_part) >= 3:
|
| 23 |
+
story = story_part[0].strip() # Extract the story
|
| 24 |
+
abilities = story_part[2].strip() # Extract the abilities
|
| 25 |
+
|
| 26 |
+
story_with_end = story + " <|endoftext|>"
|
| 27 |
+
combined = story_with_end + " " + abilities + "<|endoftext|>"
|
| 28 |
+
if print1:
|
| 29 |
+
print1 = False
|
| 30 |
+
print("\n" + combined + "\n\n")
|
| 31 |
+
tokenized_combined = tokenizer.encode(combined, add_special_tokens=True)
|
| 32 |
+
self.examples.append(torch.tensor(tokenized_combined))
|
| 33 |
+
|
| 34 |
+
def __len__(self):
|
| 35 |
+
return len(self.examples)
|
| 36 |
+
|
| 37 |
+
def __getitem__(self, i):
|
| 38 |
+
return self.examples[i]
|
| 39 |
+
|
| 40 |
+
tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
|
| 41 |
+
tokenizer.pad_token = tokenizer.eos_token
|
| 42 |
+
dataset = StoryAbilitiesDataset("batch_ds_v2.txt", tokenizer)
|
| 43 |
+
print(f"Number of examples: {len(dataset)}")
|
| 44 |
+
|
| 45 |
+
model = GPT2LMHeadModel.from_pretrained("gpt2")
|
| 46 |
+
device = torch.device("mps") if torch.backends.mps.is_available() else torch.device("cpu")
|
| 47 |
+
model.to(device)
|
| 48 |
+
|
| 49 |
+
training_args = TrainingArguments(
|
| 50 |
+
lr_scheduler_type="cosine",
|
| 51 |
+
run_name="small-3of4",
|
| 52 |
+
output_dir="./v2/abilities/small",
|
| 53 |
+
overwrite_output_dir=True,
|
| 54 |
+
num_train_epochs=15,
|
| 55 |
+
max_steps=5000,
|
| 56 |
+
save_steps=1000,
|
| 57 |
+
auto_find_batch_size=True,
|
| 58 |
+
learning_rate=1e-4,
|
| 59 |
+
max_grad_norm=1.0,
|
| 60 |
+
logging_steps=1,
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
def data_collator(features):
|
| 64 |
+
input_ids = torch.nn.utils.rnn.pad_sequence(features, batch_first=True, padding_value=tokenizer.pad_token_id)
|
| 65 |
+
labels = input_ids.clone()
|
| 66 |
+
return {"input_ids": input_ids, "labels": labels}
|
| 67 |
+
|
| 68 |
+
trainer = Trainer(
|
| 69 |
+
model=model,
|
| 70 |
+
args=training_args,
|
| 71 |
+
train_dataset=dataset,
|
| 72 |
+
data_collator=data_collator,
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
trainer.train()
|
| 76 |
+
|
| 77 |
+
model.save_pretrained("./v2/abilities/small")
|
| 78 |
+
tokenizer.save_pretrained("./v2/abilities/small")
|
midjourney/inference.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import random
|
| 3 |
+
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
| 4 |
+
|
| 5 |
+
model = GPT2LMHeadModel.from_pretrained("v2/midjourney/small")
|
| 6 |
+
tokenizer = GPT2Tokenizer.from_pretrained("v2/midjourney/small")
|
| 7 |
+
model.resize_token_embeddings(len(tokenizer))
|
| 8 |
+
|
| 9 |
+
device = torch.device("cpu")
|
| 10 |
+
|
| 11 |
+
# test examples
|
| 12 |
+
#input_text = "Marie Simmons, a dedicated librarian at the New York Public Library, was exploring the depths of the ancient manuscripts section when she stumbled upon an old, mysterious book emitting a faint, mystic glow. As she opened the cryptic pages, a burst of ancient energy enveloped her, unlocking hidden archeological knowledge and skills. The transformation was dramatic and instilled her with the agility and intellect of a seasoned archeologist adventurer. Now, Marie could decipher any historical artifact, navigate through perilous ruins with ease, and uncover secrets locked for millennia. Her life as a librarian took a thrilling turn into adventures, unearthing artifacts that could tell humanity's untold stories. Her daily routine of categorizing led her to categorize the relics of history to solve age-old mysteries.<|endoftext|>"
|
| 13 |
+
input_text = "It was an ordinary Thursday at interparkways where Ethan Cooper sat intensely focused on solving the complex cybercrime cases that surrounded him. As he rallied his team to identify and neutralize potential threats within miles of downtow elatri to each case. sa dicance suddenly clicked for evansas ithe coe itselfend aered teed gnation manipulaten behaviors consistent with heightened instinctual understanding. Suddenly: Reckless! flashed before his eyes raw intelligence cascaded no t just into actionable insights but also into boldness like watching sharp-shooting sequences in slow motion unfoldstrobbing situatio ns. With this convergence Ethereum became more than a cybersecurity expert; it transformed one elite intersectional hacker identity i nto something far beyond a mere analyst.? Ever since then Carl had become no longer merelyan cypher for justices sake ?he emergedint o existenceiriderously coiningthedigitalpuzzle unlike any other yetinelinformaticaurel.<|endoftext|>"
|
| 14 |
+
|
| 15 |
+
input_ids = tokenizer.encode(input_text, return_tensors="pt").to("cpu")
|
| 16 |
+
|
| 17 |
+
output = model.generate(
|
| 18 |
+
input_ids,
|
| 19 |
+
max_length=400,
|
| 20 |
+
num_return_sequences=1,
|
| 21 |
+
eos_token_id=tokenizer.eos_token_id,
|
| 22 |
+
repetition_penalty=2.0,
|
| 23 |
+
#top_k=200,
|
| 24 |
+
#top_p=0.9,
|
| 25 |
+
num_beams=5,
|
| 26 |
+
#temperature=1.0, #0.7
|
| 27 |
+
do_sample=True,
|
| 28 |
+
use_cache=True,
|
| 29 |
+
#output also special tokens
|
| 30 |
+
output_hidden_states=True,
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
print("\n", tokenizer.decode(output[0], skip_special_tokens=False), "\n\n", "Answer took", len(output[0]), "tokens\n")
|