if001/oscar_2023_filtered
Viewer • Updated • 4.12M • 1.31k • 3
How to use hibikaze/tiny_mixtral_ja_with_tokenizer with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="hibikaze/tiny_mixtral_ja_with_tokenizer") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("hibikaze/tiny_mixtral_ja_with_tokenizer")
model = AutoModelForCausalLM.from_pretrained("hibikaze/tiny_mixtral_ja_with_tokenizer")How to use hibikaze/tiny_mixtral_ja_with_tokenizer with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "hibikaze/tiny_mixtral_ja_with_tokenizer"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "hibikaze/tiny_mixtral_ja_with_tokenizer",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/hibikaze/tiny_mixtral_ja_with_tokenizer
How to use hibikaze/tiny_mixtral_ja_with_tokenizer with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "hibikaze/tiny_mixtral_ja_with_tokenizer" \
--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": "hibikaze/tiny_mixtral_ja_with_tokenizer",
"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 "hibikaze/tiny_mixtral_ja_with_tokenizer" \
--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": "hibikaze/tiny_mixtral_ja_with_tokenizer",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use hibikaze/tiny_mixtral_ja_with_tokenizer with Docker Model Runner:
docker model run hf.co/hibikaze/tiny_mixtral_ja_with_tokenizer
275.86Mのmixtralを日本語データセットでpretrainingしたものです
from transformers import AutoTokenizer, AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("if001/tiny_mixtral_ja")
tokenizer = AutoTokenizer.from_pretrained("if001/sentencepiece_ja", trust_remote_code=True)
prompt = "それは九月初旬のある蒸し暑い晩のことであった。私は、D坂の"
inputs = tokenizer(prompt, return_tensors="pt")
generate_ids = model.generate(
inputs.input_ids,
max_length=30,
top_k=30,
top_p=0.95,
temperature=0.6,
repetition_penalty=1.2,
do_sample=True,
)
tokenizer.decode(generate_ids[0], skip_special_tokens=True, clean_up_tokenization_spaces=False)
>> それは九月初旬のある蒸し暑い晩のことであった。私は、D坂の茶舗を後にして、その路地の角に横丁をあるいて居る、と云うと、丁度其処から、
英語と日本語のデータセットを使用
total tokens: 8.64B
wikipedia_ja: 844.65M
wikipedia_en: 3.80B
open-text-books: 60.17M
oscar: 3.85B
aozorabunko: 92.97M
all_special_ids: [1, 2, 3, 0, 4]
all_special_tokens: ['<BOS>', '<EOS>', '<UNK>', '<PAD>', '<MASK>']