初始化项目,由ModelHub XC社区提供模型
Model: hakurei/lit-6B Source: Original Platform
This commit is contained in:
27
.gitattributes
vendored
Normal file
27
.gitattributes
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
67
README.md
Normal file
67
README.md
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
---
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
tags:
|
||||||
|
- pytorch
|
||||||
|
- causal-lm
|
||||||
|
license: mit
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Lit-6B - A Large Fine-tuned Model For Fictional Storytelling
|
||||||
|
|
||||||
|
Lit-6B is a GPT-J 6B model fine-tuned on 2GB of a diverse range of light novels, erotica, and annotated literature for the purpose of generating novel-like fictional text.
|
||||||
|
|
||||||
|
## Model Description
|
||||||
|
|
||||||
|
The model used for fine-tuning is [GPT-J](https://github.com/kingoflolz/mesh-transformer-jax), which is a 6 billion parameter auto-regressive language model trained on [The Pile](https://pile.eleuther.ai/).
|
||||||
|
|
||||||
|
## Training Data & Annotative Prompting
|
||||||
|
|
||||||
|
The data used in fine-tuning has been gathered from various sources such as the [Gutenberg Project](https://www.gutenberg.org/). The annotated fiction dataset has prepended tags to assist in generating towards a particular style. Here is an example prompt that shows how to use the annotations.
|
||||||
|
|
||||||
|
```
|
||||||
|
[ Title: The Dunwich Horror; Author: H. P. Lovecraft; Genre: Horror; Tags: 3rdperson, scary; Style: Dark ]
|
||||||
|
***
|
||||||
|
When a traveler in north central Massachusetts takes the wrong fork...
|
||||||
|
```
|
||||||
|
|
||||||
|
The annotations can be mixed and matched to help generate towards a specific style.
|
||||||
|
|
||||||
|
## Downstream Uses
|
||||||
|
|
||||||
|
This model can be used for entertainment purposes and as a creative writing assistant for fiction writers.
|
||||||
|
|
||||||
|
## Example Code
|
||||||
|
|
||||||
|
```
|
||||||
|
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||||||
|
|
||||||
|
model = AutoModelForCausalLM.from_pretrained('hakurei/lit-6B')
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained('hakurei/lit-6B')
|
||||||
|
|
||||||
|
prompt = '''[ Title: The Dunwich Horror; Author: H. P. Lovecraft; Genre: Horror ]
|
||||||
|
***
|
||||||
|
When a traveler'''
|
||||||
|
|
||||||
|
input_ids = tokenizer.encode(prompt, return_tensors='pt')
|
||||||
|
output = model.generate(input_ids, do_sample=True, temperature=1.0, top_p=0.9, repetition_penalty=1.2, max_length=len(input_ids[0])+100, pad_token_id=tokenizer.eos_token_id)
|
||||||
|
|
||||||
|
generated_text = tokenizer.decode(output[0])
|
||||||
|
print(generated_text)
|
||||||
|
```
|
||||||
|
|
||||||
|
An example output from this code produces a result that will look similar to:
|
||||||
|
|
||||||
|
```
|
||||||
|
[ Title: The Dunwich Horror; Author: H. P. Lovecraft; Genre: Horror ]
|
||||||
|
***
|
||||||
|
When a traveler comes to an unknown region, his thoughts turn inevitably towards the old gods and legends which cluster around its appearance. It is not that he believes in them or suspects their reality—but merely because they are present somewhere else in creation just as truly as himself, and so belong of necessity in any landscape whose features cannot be altogether strange to him. Moreover, man has been prone from ancient times to brood over those things most connected with the places where he dwells. Thus the Olympian deities who ruled Hyper
|
||||||
|
```
|
||||||
|
|
||||||
|
## Team members and Acknowledgements
|
||||||
|
|
||||||
|
This project would not have been possible without the computational resources graciously provided by the [TPU Research Cloud](https://sites.research.google/trc/)
|
||||||
|
|
||||||
|
- [Anthony Mercurio](https://github.com/harubaru)
|
||||||
|
- Imperishable_NEET
|
||||||
1
added_tokens.json
Normal file
1
added_tokens.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"<|extratoken_70|>": 50326, "<|extratoken_24|>": 50280, "<|extratoken_128|>": 50384, "<|extratoken_111|>": 50367, "<|extratoken_124|>": 50380, "<|extratoken_122|>": 50378, "<|extratoken_86|>": 50342, "<|extratoken_98|>": 50354, "<|extratoken_101|>": 50357, "<|extratoken_92|>": 50348, "<|extratoken_41|>": 50297, "<|extratoken_25|>": 50281, "<|extratoken_110|>": 50366, "<|extratoken_42|>": 50298, "<|extratoken_138|>": 50394, "<|extratoken_46|>": 50302, "<|extratoken_74|>": 50330, "<|extratoken_53|>": 50309, "<|extratoken_77|>": 50333, "<|extratoken_115|>": 50371, "<|extratoken_94|>": 50350, "<|extratoken_81|>": 50337, "<|extratoken_91|>": 50347, "<|extratoken_117|>": 50373, "<|extratoken_80|>": 50336, "<|extratoken_13|>": 50269, "<|extratoken_57|>": 50313, "<|extratoken_104|>": 50360, "<|extratoken_121|>": 50377, "<|extratoken_130|>": 50386, "<|extratoken_82|>": 50338, "<|extratoken_126|>": 50382, "<|extratoken_112|>": 50368, "<|extratoken_132|>": 50388, "<|extratoken_62|>": 50318, "<|extratoken_141|>": 50397, "<|extratoken_63|>": 50319, "<|extratoken_34|>": 50290, "<|extratoken_75|>": 50331, "<|extratoken_139|>": 50395, "<|extratoken_49|>": 50305, "<|extratoken_96|>": 50352, "<|extratoken_69|>": 50325, "<|extratoken_95|>": 50351, "<|extratoken_140|>": 50396, "<|extratoken_21|>": 50277, "<|extratoken_52|>": 50308, "<|extratoken_68|>": 50324, "<|extratoken_116|>": 50372, "<|extratoken_67|>": 50323, "<|extratoken_137|>": 50393, "<|extratoken_6|>": 50262, "<|extratoken_23|>": 50279, "<|extratoken_20|>": 50276, "<|extratoken_9|>": 50265, "<|extratoken_83|>": 50339, "<|extratoken_29|>": 50285, "<|extratoken_108|>": 50364, "<|extratoken_106|>": 50362, "<|extratoken_107|>": 50363, "<|extratoken_18|>": 50274, "<|extratoken_88|>": 50344, "<|extratoken_102|>": 50358, "<|extratoken_17|>": 50273, "<|extratoken_118|>": 50374, "<|extratoken_90|>": 50346, "<|extratoken_37|>": 50293, "<|extratoken_119|>": 50375, "<|extratoken_19|>": 50275, "<|extratoken_79|>": 50335, "<|extratoken_78|>": 50334, "<|extratoken_8|>": 50264, "<|extratoken_66|>": 50322, "<|extratoken_51|>": 50307, "<|extratoken_2|>": 50258, "<|extratoken_89|>": 50345, "<|extratoken_39|>": 50295, "<|extratoken_135|>": 50391, "<|extratoken_129|>": 50385, "<|extratoken_22|>": 50278, "<|extratoken_10|>": 50266, "<|extratoken_84|>": 50340, "<|extratoken_1|>": 50257, "<|extratoken_56|>": 50312, "<|extratoken_58|>": 50314, "<|extratoken_32|>": 50288, "<|extratoken_48|>": 50304, "<|extratoken_35|>": 50291, "<|extratoken_85|>": 50341, "<|extratoken_16|>": 50272, "<|extratoken_103|>": 50359, "<|extratoken_4|>": 50260, "<|extratoken_7|>": 50263, "<|extratoken_61|>": 50317, "<|extratoken_72|>": 50328, "<|extratoken_15|>": 50271, "<|extratoken_64|>": 50320, "<|extratoken_31|>": 50287, "<|extratoken_28|>": 50284, "<|extratoken_114|>": 50370, "<|extratoken_5|>": 50261, "<|extratoken_136|>": 50392, "<|extratoken_134|>": 50390, "<|extratoken_127|>": 50383, "<|extratoken_47|>": 50303, "<|extratoken_73|>": 50329, "<|extratoken_55|>": 50311, "<|extratoken_100|>": 50356, "<|extratoken_143|>": 50399, "<|extratoken_59|>": 50315, "<|extratoken_27|>": 50283, "<|extratoken_131|>": 50387, "<|extratoken_125|>": 50381, "<|extratoken_142|>": 50398, "<|extratoken_26|>": 50282, "<|extratoken_105|>": 50361, "<|extratoken_71|>": 50327, "<|extratoken_133|>": 50389, "<|extratoken_33|>": 50289, "<|extratoken_87|>": 50343, "<|extratoken_60|>": 50316, "<|extratoken_12|>": 50268, "<|extratoken_113|>": 50369, "<|extratoken_109|>": 50365, "<|extratoken_120|>": 50376, "<|extratoken_40|>": 50296, "<|extratoken_38|>": 50294, "<|extratoken_54|>": 50310, "<|extratoken_30|>": 50286, "<|extratoken_44|>": 50300, "<|extratoken_3|>": 50259, "<|extratoken_14|>": 50270, "<|extratoken_11|>": 50267, "<|extratoken_123|>": 50379, "<|extratoken_93|>": 50349, "<|extratoken_36|>": 50292, "<|extratoken_50|>": 50306, "<|extratoken_43|>": 50299, "<|extratoken_65|>": 50321, "<|extratoken_97|>": 50353, "<|extratoken_76|>": 50332, "<|extratoken_99|>": 50355, "<|extratoken_45|>": 50301}
|
||||||
36
config.json
Normal file
36
config.json
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"activation_function": "gelu_new",
|
||||||
|
"architectures": [
|
||||||
|
"GPTJForCausalLM"
|
||||||
|
],
|
||||||
|
"attn_pdrop": 0.0,
|
||||||
|
"bos_token_id": 50256,
|
||||||
|
"embd_pdrop": 0.0,
|
||||||
|
"eos_token_id": 50256,
|
||||||
|
"gradient_checkpointing": false,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"layer_norm_epsilon": 1e-05,
|
||||||
|
"model_type": "gptj",
|
||||||
|
"n_embd": 4096,
|
||||||
|
"n_head": 16,
|
||||||
|
"n_layer": 28,
|
||||||
|
"n_positions": 2048,
|
||||||
|
"rotary_dim": 64,
|
||||||
|
"summary_activation": null,
|
||||||
|
"summary_first_dropout": 0.1,
|
||||||
|
"summary_proj_to_labels": true,
|
||||||
|
"summary_type": "cls_index",
|
||||||
|
"summary_use_proj": true,
|
||||||
|
"transformers_version": "4.10.0.dev0",
|
||||||
|
"tokenizer_class": "GPT2Tokenizer",
|
||||||
|
"task_specific_params": {
|
||||||
|
"text-generation": {
|
||||||
|
"do_sample": true,
|
||||||
|
"temperature": 1.0,
|
||||||
|
"max_length": 50
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"torch_dtype": "float16",
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 50400
|
||||||
|
}
|
||||||
50001
merges.txt
Normal file
50001
merges.txt
Normal file
File diff suppressed because it is too large
Load Diff
3
pytorch_model.bin
Normal file
3
pytorch_model.bin
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:4bfab409adbbc7ae2862ba0d422c03437d45d2aa31a374e9af1d3871b1c70535
|
||||||
|
size 12106057650
|
||||||
1
special_tokens_map.json
Normal file
1
special_tokens_map.json
Normal file
@@ -0,0 +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}}
|
||||||
1
tokenizer.json
Normal file
1
tokenizer.json
Normal file
File diff suppressed because one or more lines are too long
1
tokenizer_config.json
Normal file
1
tokenizer_config.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"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, "errors": "replace", "model_max_length": 1024, "special_tokens_map_file": null, "name_or_path": "hakurei/c1-6B", "tokenizer_class": "GPT2Tokenizer"}
|
||||||
1
vocab.json
Normal file
1
vocab.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user