Text Generation
Transformers
Safetensors
Korean
English
perdix
custom_code
conversational
instruct
differential-attention
polynorm
Instructions to use prismdata/Perdix-1.1B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prismdata/Perdix-1.1B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="prismdata/Perdix-1.1B-Instruct", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("prismdata/Perdix-1.1B-Instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use prismdata/Perdix-1.1B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prismdata/Perdix-1.1B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prismdata/Perdix-1.1B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/prismdata/Perdix-1.1B-Instruct
- SGLang
How to use prismdata/Perdix-1.1B-Instruct 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 "prismdata/Perdix-1.1B-Instruct" \ --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": "prismdata/Perdix-1.1B-Instruct", "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 "prismdata/Perdix-1.1B-Instruct" \ --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": "prismdata/Perdix-1.1B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use prismdata/Perdix-1.1B-Instruct with Docker Model Runner:
docker model run hf.co/prismdata/Perdix-1.1B-Instruct
Download configuration_perdix.py from prismdata/Perdix-1.1B-Instruct: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/prismdata/Perdix-1.1B-Instruct/resolve/main/configuration_perdix.py
- Command line
-
hf download hf://prismdata/Perdix-1.1B-Instruct/configuration_perdix.py
-
curl -L -o configuration_perdix.py https://huggingface.co/prismdata/Perdix-1.1B-Instruct/resolve/main/configuration_perdix.py
1.29 kB
| """Perdix 설정 (transformers 연동용).""" | |
| from transformers import PretrainedConfig | |
| class PerdixConfig(PretrainedConfig): | |
| model_type = "perdix" | |
| attribute_map = {"hidden_size": "dim", "num_hidden_layers": "n_layers", | |
| "num_attention_heads": "n_heads", | |
| "max_position_embeddings": "max_seq_len"} | |
| def __init__(self, vocab_size=49152, dim=2048, n_layers=20, n_heads=16, | |
| ffn_dim=8192, max_seq_len=2048, rope_theta=10000.0, | |
| norm_eps=1e-5, init_std=0.02, bos_token_id=0, eos_token_id=0, | |
| pad_token_id=1, tie_word_embeddings=True, **kwargs): | |
| self.vocab_size = vocab_size | |
| self.dim = dim | |
| self.n_layers = n_layers | |
| self.n_heads = n_heads # differential attention은 head_dim을 반으로 나눠 2쌍 사용 | |
| self.ffn_dim = ffn_dim | |
| self.max_seq_len = max_seq_len | |
| self.rope_theta = rope_theta | |
| self.norm_eps = norm_eps | |
| self.init_std = init_std | |
| kwargs.setdefault("use_cache", False) # KV 캐시 미구현 | |
| super().__init__(bos_token_id=bos_token_id, eos_token_id=eos_token_id, | |
| pad_token_id=pad_token_id, | |
| tie_word_embeddings=tie_word_embeddings, **kwargs) | |