Update README.md
Browse files
README.md
CHANGED
|
@@ -10,7 +10,113 @@ tags:
|
|
| 10 |
- words
|
| 11 |
- text2gpt
|
| 12 |
---
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
- words
|
| 11 |
- text2gpt
|
| 12 |
---
|
| 13 |
+
# Text2GPT (81.9M parameters)
|
| 14 |
+
Currently Text2GPT uses the base model: distilbert/distilgpt2 to fine-tune
|
| 15 |
+
|
| 16 |
+
# Files
|
| 17 |
+
The following JSON files here:
|
| 18 |
+
- tokenizer_config.json
|
| 19 |
+
```json
|
| 20 |
+
{
|
| 21 |
+
"add_bos_token": false,
|
| 22 |
+
"add_prefix_space": false,
|
| 23 |
+
"added_tokens_decoder": {
|
| 24 |
+
"50256": {
|
| 25 |
+
"content": "<|endoftext|>",
|
| 26 |
+
"lstrip": false,
|
| 27 |
+
"normalized": true,
|
| 28 |
+
"rstrip": false,
|
| 29 |
+
"single_word": false,
|
| 30 |
+
"special": true
|
| 31 |
+
}
|
| 32 |
+
},
|
| 33 |
+
"bos_token": "<|endoftext|>",
|
| 34 |
+
"clean_up_tokenization_spaces": false,
|
| 35 |
+
"eos_token": "<|endoftext|>",
|
| 36 |
+
"errors": "replace",
|
| 37 |
+
"extra_special_tokens": {},
|
| 38 |
+
"model_max_length": 1024,
|
| 39 |
+
"pad_token": "<|endoftext|>",
|
| 40 |
+
"tokenizer_class": "GPT2Tokenizer",
|
| 41 |
+
"unk_token": "<|endoftext|>"
|
| 42 |
+
}
|
| 43 |
+
```
|
| 44 |
+
- config.json
|
| 45 |
+
```json
|
| 46 |
+
{
|
| 47 |
+
"_num_labels": 1,
|
| 48 |
+
"activation_function": "gelu_new",
|
| 49 |
+
"architectures": [
|
| 50 |
+
"GPT2LMHeadModel"
|
| 51 |
+
],
|
| 52 |
+
"attn_pdrop": 0.1,
|
| 53 |
+
"bos_token_id": 50256,
|
| 54 |
+
"embd_pdrop": 0.1,
|
| 55 |
+
"eos_token_id": 50256,
|
| 56 |
+
"id2label": {
|
| 57 |
+
"0": "LABEL_0"
|
| 58 |
+
},
|
| 59 |
+
"initializer_range": 0.02,
|
| 60 |
+
"label2id": {
|
| 61 |
+
"LABEL_0": 0
|
| 62 |
+
},
|
| 63 |
+
"layer_norm_epsilon": 1e-05,
|
| 64 |
+
"model_type": "gpt2",
|
| 65 |
+
"n_ctx": 1024,
|
| 66 |
+
"n_embd": 768,
|
| 67 |
+
"n_head": 12,
|
| 68 |
+
"n_inner": null,
|
| 69 |
+
"n_layer": 6,
|
| 70 |
+
"n_positions": 1024,
|
| 71 |
+
"reorder_and_upcast_attn": false,
|
| 72 |
+
"resid_pdrop": 0.1,
|
| 73 |
+
"scale_attn_by_inverse_layer_idx": false,
|
| 74 |
+
"scale_attn_weights": true,
|
| 75 |
+
"summary_activation": null,
|
| 76 |
+
"summary_first_dropout": 0.1,
|
| 77 |
+
"summary_proj_to_labels": true,
|
| 78 |
+
"summary_type": "cls_index",
|
| 79 |
+
"summary_use_proj": true,
|
| 80 |
+
"task_specific_params": {
|
| 81 |
+
"text-generation": {
|
| 82 |
+
"do_sample": true,
|
| 83 |
+
"max_length": 50
|
| 84 |
+
}
|
| 85 |
+
},
|
| 86 |
+
"torch_dtype": "float32",
|
| 87 |
+
"transformers_version": "4.50.3",
|
| 88 |
+
"use_cache": true,
|
| 89 |
+
"vocab_size": 50257
|
| 90 |
+
}
|
| 91 |
+
```
|
| 92 |
+
other files...
|
| 93 |
+
# Use it:
|
| 94 |
+
## Load model directly
|
| 95 |
+
```python
|
| 96 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 97 |
+
|
| 98 |
+
tokenizer = AutoTokenizer.from_pretrained("kulia-moon/Text2GPT")
|
| 99 |
+
model = AutoModelForCausalLM.from_pretrained("kulia-moon/Text2GPT")
|
| 100 |
+
```
|
| 101 |
+
## Use a pipeline as a high-level helper
|
| 102 |
+
```python
|
| 103 |
+
from transformers import pipeline
|
| 104 |
+
|
| 105 |
+
pipe = pipeline("text-generation", model="kulia-moon/Text2GPT")
|
| 106 |
+
```
|
| 107 |
+
# vLLM use:
|
| 108 |
+
## Deploy with docker on Linux:
|
| 109 |
+
```shell
|
| 110 |
+
docker run --runtime nvidia --gpus all \
|
| 111 |
+
--name my_vllm_container \
|
| 112 |
+
-v ~/.cache/huggingface:/root/.cache/huggingface \
|
| 113 |
+
--env "HUGGING_FACE_HUB_TOKEN=<secret>" \
|
| 114 |
+
-p 8000:8000 \
|
| 115 |
+
--ipc=host \
|
| 116 |
+
vllm/vllm-openai:latest \
|
| 117 |
+
# --model kulia-moon/Text2GPT
|
| 118 |
+
```
|
| 119 |
+
## Load and run the model:
|
| 120 |
+
```shell
|
| 121 |
+
docker exec -it my_vllm_container bash -c "vllm serve kulia-moon/Text2GPT"
|
| 122 |
+
```
|