Text Generation
Transformers
PyTorch
Safetensors
Japanese
gpt_neox
gpt-neox
japanese
text-generation-inference
Instructions to use stockmark/gpt-neox-japanese-1.4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use stockmark/gpt-neox-japanese-1.4b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="stockmark/gpt-neox-japanese-1.4b")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("stockmark/gpt-neox-japanese-1.4b") model = AutoModelForCausalLM.from_pretrained("stockmark/gpt-neox-japanese-1.4b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use stockmark/gpt-neox-japanese-1.4b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "stockmark/gpt-neox-japanese-1.4b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "stockmark/gpt-neox-japanese-1.4b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/stockmark/gpt-neox-japanese-1.4b
- SGLang
How to use stockmark/gpt-neox-japanese-1.4b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "stockmark/gpt-neox-japanese-1.4b" \ --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": "stockmark/gpt-neox-japanese-1.4b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
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 "stockmark/gpt-neox-japanese-1.4b" \ --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": "stockmark/gpt-neox-japanese-1.4b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use stockmark/gpt-neox-japanese-1.4b with Docker Model Runner:
docker model run hf.co/stockmark/gpt-neox-japanese-1.4b
stockmark/gpt-neox-japanese-1.4b
This repository provides a GPT-NeoX based model with 1.4B parameters pre-trained on Japanese corpus of about 20B tokens. This model is developed by Stockmark Inc.
How to use
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
# Use torch.bfloat16 for A100 GPU and torch.flaot16 for the older generation GPUs
torch_dtype = torch.bfloat16 if torch.cuda.is_available() and hasattr(torch.cuda, "is_bf16_supported") and torch.cuda.is_bf16_supported() else torch.float16
model = AutoModelForCausalLM.from_pretrained("stockmark/gpt-neox-japanese-1.4b", device_map="auto", torch_dtype=torch_dtype)
tokenizer = AutoTokenizer.from_pretrained("stockmark/gpt-neox-japanese-1.4b")
inputs = tokenizer("自然言語処理は", return_tensors="pt").to(model.device)
with torch.no_grad():
tokens = model.generate(
**inputs,
max_new_tokens=128,
repetition_penalty=1.1
)
output = tokenizer.decode(tokens[0], skip_special_tokens=True)
print(output)
Example:
Training dataset
- Japanese Web Corpus (ja): 8.6B tokens (This dataset will not be released.)
- Wikipedia (ja): 0.88B tokens
- CC100 (ja): 10.5B tokens
Training setting
- Trained using HuggingFace Trainer and DeepSpeed (ZeRO-2)
- 8 A100 GPUs (40GB) at ABCI
- Mixed Precision (BF16)
License
Developed by
Author
- Downloads last month
- 524