from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "Chang-chih/leviathan-9B-MoE"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype=torch.bfloat16,
trust_remote_code=True
)
prompt = "你是誰?"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=50)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
使用 Ollama
bash
ollama run hf.co/Chang-chih/leviathan-9B-MoE "你的指令"
硬體需求 (Hardware Requirements)
GPU VRAM:建議 16GB 以上 (可使用 4-bit 量化)
系統:Linux / Windows (透過 WSL)
授權 (License)
本模型採用 Apache-2.0 授權條款。
引用 (Citation)
如果您使用此模型,請引用:
bibtex
@misc{leviathan-9b-moe,
author = {Chang-chih},
title = {Leviathan-9B-MoE: A Mixture-of-Experts Model for Local Vision-Language Integration},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/Chang-chih/leviathan-9B-MoE}
}