ikedachin/CC-news-2024-October-cleaned-cpt-set-250127
Viewer • Updated • 23.5k • 34
How to use ikedachin/llm-jp-3-13b-october-news-250311-merged with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="ikedachin/llm-jp-3-13b-october-news-250311-merged") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("ikedachin/llm-jp-3-13b-october-news-250311-merged")
model = AutoModelForCausalLM.from_pretrained("ikedachin/llm-jp-3-13b-october-news-250311-merged", device_map="auto")How to use ikedachin/llm-jp-3-13b-october-news-250311-merged with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "ikedachin/llm-jp-3-13b-october-news-250311-merged"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ikedachin/llm-jp-3-13b-october-news-250311-merged",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/ikedachin/llm-jp-3-13b-october-news-250311-merged
How to use ikedachin/llm-jp-3-13b-october-news-250311-merged with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "ikedachin/llm-jp-3-13b-october-news-250311-merged" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ikedachin/llm-jp-3-13b-october-news-250311-merged",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "ikedachin/llm-jp-3-13b-october-news-250311-merged" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ikedachin/llm-jp-3-13b-october-news-250311-merged",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use ikedachin/llm-jp-3-13b-october-news-250311-merged with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ikedachin/llm-jp-3-13b-october-news-250311-merged to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ikedachin/llm-jp-3-13b-october-news-250311-merged to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for ikedachin/llm-jp-3-13b-october-news-250311-merged to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="ikedachin/llm-jp-3-13b-october-news-250311-merged",
max_seq_length=2048,
)How to use ikedachin/llm-jp-3-13b-october-news-250311-merged with Docker Model Runner:
docker model run hf.co/ikedachin/llm-jp-3-13b-october-news-250311-merged
This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.
2024年9月、10月のニュース情報を継続事前学習したもの
epoch:3
r:128
lora_alpha:512
lr:3e-4
embedding_lr: 3e-5
狙い: lora_alphaを大きくして、SFTによる記憶忘却に耐えられるようにCPTによるベースモデルへの知識埋め込みの影響を大きくする
# 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日の記者会見で<省略>
Base model
llm-jp/llm-jp-3-13b