Text Generation
Transformers
PyTorch
Japanese
gpt_neox
japanese
causal-lm
quantized
text-generation-inference
8-bit precision
Instructions to use kyo-takano/open-calm-7b-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kyo-takano/open-calm-7b-8bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kyo-takano/open-calm-7b-8bit")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kyo-takano/open-calm-7b-8bit") model = AutoModelForCausalLM.from_pretrained("kyo-takano/open-calm-7b-8bit") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use kyo-takano/open-calm-7b-8bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kyo-takano/open-calm-7b-8bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kyo-takano/open-calm-7b-8bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/kyo-takano/open-calm-7b-8bit
- SGLang
How to use kyo-takano/open-calm-7b-8bit 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 "kyo-takano/open-calm-7b-8bit" \ --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": "kyo-takano/open-calm-7b-8bit", "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 "kyo-takano/open-calm-7b-8bit" \ --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": "kyo-takano/open-calm-7b-8bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use kyo-takano/open-calm-7b-8bit with Docker Model Runner:
docker model run hf.co/kyo-takano/open-calm-7b-8bit
OpenCALM-7B - 8bit
8-bit quantized version of OpenCALM-7B by CyberAgent (under CC BY-SA 4.0)
When using this quantized model, please be sure to give credit to the original.
Setup
pip install -q -U bitsandbytes
pip install -q -U git+https://github.com/huggingface/transformers.git
pip install -q -U git+https://github.com/huggingface/accelerate.git
Usage
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
MODEL_ID = "kyo-takano/open-calm-7b-8bit"
model = AutoModelForCausalLM.from_pretrained(MODEL_ID)
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
inputs = tokenizer("AIใซใใฃใฆ็ง้ใฎๆฎใใใฏใ", return_tensors="pt").to(model.device)
with torch.no_grad():
tokens = model.generate(
**inputs,
max_new_tokens=64,
do_sample=True,
temperature=0.7,
top_p=0.9,
repetition_penalty=1.05,
pad_token_id=tokenizer.pad_token_id,
)
output = tokenizer.decode(tokens[0], skip_special_tokens=True)
print(output)
Model Details
- Developed by: CyberAgent, Inc.
- Quantized by: Kyo Takano
- Model type: Transformer-based Language Model
- Language: Japanese
- Library: GPT-NeoX
- License: OpenCALM is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA 4.0). When using this model, please provide appropriate credit to CyberAgent, Inc.
- Downloads last month
- 8