|
--- |
|
license: apache-2.0 |
|
--- |
|
# cyberagent-calm2-7b-chat-GPTQ-calib-ja-1k |
|
[cyberagentさんが公開しているcalm2-7b-chat](https://huggingface.co/cyberagent/calm2-7b-chat)を |
|
日本語のキャリブレーションセットで生成したGPTQモデルになります。 |
|
|
|
キャリブレーションセットは[izumi-lab/wikipedia-ja-20230720](https://huggingface.co/datasets/izumi-lab/wikipedia-ja-20230720)から、 |
|
1kほどランダムサンプリングしたものと、 |
|
[ELYZA-tasks-100](https://huggingface.co/datasets/elyza/ELYZA-tasks-100)のinput/outputを計200ほど追加しています。 |
|
[mmnga/wikipedia-ja-20230720-1k](https://huggingface.co/datasets/mmnga/wikipedia-ja-20230720-1k) |
|
|
|
モデル一覧 |
|
GPTQ |
|
[mmnga/cyberagent-calm2-7b-GPTQ-calib-ja-1k](https://huggingface.co/mmnga/cyberagent-calm2-7b-GPTQ-calib-ja-1k) |
|
[mmnga/cyberagent-calm2-7b-chat-GPTQ-calib-ja-1k](https://huggingface.co/mmnga/cyberagent-calm2-7b-chat-GPTQ-calib-ja-1k) |
|
|
|
GGUF |
|
[mmnga/cyberagent-calm2-7b-gguf](https://huggingface.co/mmnga/cyberagent-calm2-7b-gguf) |
|
[mmnga/cyberagent-calm2-7b-chat-gguf](https://huggingface.co/mmnga/cyberagent-calm2-7b-chat-gguf) |
|
|
|
## Usage |
|
|
|
~~~Bash |
|
pip install auto-gptq[triton]==0.4.2 transformers==4.34.1 |
|
~~~ |
|
|
|
~~~python |
|
import torch |
|
from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig |
|
from transformers import AutoTokenizer , AutoModelForCausalLM |
|
|
|
if torch.cuda.is_available(): |
|
device_name = torch.cuda.get_device_name(0) |
|
|
|
model_name_or_path = "mmnga/cyberagent-calm2-7b-chat-GPTQ-calib-ja-1k" |
|
|
|
# Tokenizer |
|
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=True) |
|
|
|
# Model |
|
model = AutoGPTQForCausalLM.from_quantized(model_name_or_path, use_safetensors=True, device="cuda:0", use_triton=("A100" in device_name)) |
|
|
|
# Your test prompt |
|
prompt = """ |
|
USER: 今日の夕食のレシピを紹介してください。 |
|
ASSISTANT: """ |
|
print(tokenizer.decode(model.generate(**tokenizer(prompt, return_tensors="pt").to(model.device), max_length=128)[0])) |
|
~~~ |