--- 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. [](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 = <> # 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日の記者会見で<省略> ```