File size: 2,200 Bytes
25f5184 6a32981 25f5184 0512ab9 25f5184 f3f9ce1 0512ab9 8f6c9af |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
---
base_model: llm-jp/llm-jp-3-13b
tags:
- text-generation-inference
- transformers
- unsloth
- llama
- trl
- sft
license: apache-2.0
language:
- en
- ja
datasets:
- ikedachin/CC-news-2024-October-cleaned-cpt-set-250127
---
# Uploaded model
- **Developed by:** ikedachin
- **License:** apache-2.0
- **Finetuned from model :** llm-jp/llm-jp-3-13b
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
2024年9月、10月のニュース情報を継続事前学習したもの
epoch:3
r:128
lora_alpha:512
lr:3e-4
embedding_lr: 3e-5
狙い: lora_alphaを大きくして、SFTによる記憶忘却に耐えられるようにCPTによるベースモデルへの知識埋め込みの影響を大きくする
```python
# import libraries
import tqdm
import torch
from datasets import load_dataset
from transformers import AutoModelForCausalLM, AutoTokenizer
# config
model_id = "ikedachin/llm-jp-3-13b-october-news-250311-merged"
# set Token of Huggingface
HF_TOKEN = <<YOUR_TOKEN>>
# download model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map = "auto",
torch_dtype = torch.bfloat16,
token = HF_TOKEN
)
tokenizer = AutoTokenizer.from_pretrained(model_id, token=HF_TOKEN)
# define inference function
def generate_from_model(input):
prompt = f"""{input}"""
input = tokenizer(prompt, return_tensors='pt', add_special_tokens=True).to(model.device)
input.pop('token_type_ids')
output = model.generate(**input, max_new_tokens = 1000, use_cache = False, do_sample=False, repetition_penalty=1.2)
return tokenizer.decode(output[0], skip_special_tokens=True)
# input prompt and inference
print(generate_from_model('石破茂さんは'))
# 石破茂さんは総裁選の最中に「国会で議論すべき」と発言を撤回。\n石破新首相は10月27日投開票の日程で、衆議院総選挙を行う意向を表明しました。9月30日の記者会見で<省略>
``` |