Instructions to use kakaocorp/kanana-safeguard-8b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kakaocorp/kanana-safeguard-8b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kakaocorp/kanana-safeguard-8b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kakaocorp/kanana-safeguard-8b") model = AutoModelForCausalLM.from_pretrained("kakaocorp/kanana-safeguard-8b", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kakaocorp/kanana-safeguard-8b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kakaocorp/kanana-safeguard-8b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kakaocorp/kanana-safeguard-8b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kakaocorp/kanana-safeguard-8b
- SGLang
How to use kakaocorp/kanana-safeguard-8b 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 "kakaocorp/kanana-safeguard-8b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kakaocorp/kanana-safeguard-8b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "kakaocorp/kanana-safeguard-8b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kakaocorp/kanana-safeguard-8b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use kakaocorp/kanana-safeguard-8b with Docker Model Runner:
docker model run hf.co/kakaocorp/kanana-safeguard-8b
이 모델은 범죄 관련 질문답 guardrail 용도 인가요?
#1
by Day1Kim - opened
안녕하세요 모델 제공해주셔서 감사합니다.
kakaocorp/kanana-safeguard-8b 이 모델은 현재 s4 범죄 관련 질문답 가드레일 전용일까요?
안녕하세요. kanana safeguard 모델에 관심 가져주셔서 감사합니다.
모델카드에 포함된 작동 예시가 범죄(S4) 카테고리에 한정되어 있어 해당 리스크 전용 모델로 이해될 수 있으나 kakaocorp/kanana-safeguard-8b는 범죄 외에도 총 7가지 리스크 카테고리를 아우르는 다중 분류 기반 유해 콘텐츠 탐지 모델입니다. 본 모델이 탐지할 수 있는 리스크 카테고리는 증오(S1), 괴롭힘(S2), 성적 콘텐츠(S3), 범죄(S4), 아동 성착취(S5), 자살 및 자해(S6), 잘못된 정보(S7)로 구성되어 있습니다.
각 리스크 유형에 대한 자세한 설명은 모델카드 본문의 '리스크 분류 체계' 섹션 내 표 1을 참고 부탁드리며, 추가로 궁금하신 점 있으시면 언제든지 말씀 주세요.
감사합니다. 모델 제작 또는 파인튜닝시 사용한 데이터는 오픈 데이터인가요?
sugar-free changed discussion status to closed