Text Generation
Transformers
Safetensors
mistral
mergekit
Merge
conversational
text-generation-inference
Instructions to use Cran-May/PCB-NRSheared-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Cran-May/PCB-NRSheared-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Cran-May/PCB-NRSheared-2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Cran-May/PCB-NRSheared-2") model = AutoModelForCausalLM.from_pretrained("Cran-May/PCB-NRSheared-2") 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
- vLLM
How to use Cran-May/PCB-NRSheared-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Cran-May/PCB-NRSheared-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Cran-May/PCB-NRSheared-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Cran-May/PCB-NRSheared-2
- SGLang
How to use Cran-May/PCB-NRSheared-2 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 "Cran-May/PCB-NRSheared-2" \ --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": "Cran-May/PCB-NRSheared-2", "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 "Cran-May/PCB-NRSheared-2" \ --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": "Cran-May/PCB-NRSheared-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Cran-May/PCB-NRSheared-2 with Docker Model Runner:
docker model run hf.co/Cran-May/PCB-NRSheared-2
| base_model: | |
| - AlSamCur123/Mistral-Small3-24B-InstructContinuedFine | |
| - trashpanda-org/MS-24B-Instruct-Mullein-v0 | |
| - huihui-ai/Mistral-Small-24B-Instruct-2501-abliterated | |
| library_name: transformers | |
| tags: | |
| - mergekit | |
| - merge | |
| # merge | |
| This is a merge of pre-trained language models created using [mergekit](https://github.com/cg123/mergekit). | |
| ## Merge Details | |
| ### Merge Method | |
| This model was merged using the [DELLA](https://arxiv.org/abs/2406.11617) merge method using [huihui-ai/Mistral-Small-24B-Instruct-2501-abliterated](https://huggingface.co/huihui-ai/Mistral-Small-24B-Instruct-2501-abliterated) as a base. | |
| ### Models Merged | |
| The following models were included in the merge: | |
| * [AlSamCur123/Mistral-Small3-24B-InstructContinuedFine](https://huggingface.co/AlSamCur123/Mistral-Small3-24B-InstructContinuedFine) | |
| * [trashpanda-org/MS-24B-Instruct-Mullein-v0](https://huggingface.co/trashpanda-org/MS-24B-Instruct-Mullein-v0) | |
| ### Configuration | |
| The following YAML configuration was used to produce this model: | |
| ```yaml | |
| # 文件名: pcb_della_merge_12b.yaml | |
| merge_method: della # 仍然使用 DELLA,因为它是一个强大的自适应剪裁方法 | |
| base_model: huihui-ai/Mistral-Small-24B-Instruct-2501-abliterated | |
| models: | |
| - model: trashpanda-org/MS-24B-Instruct-Mullein-v0 | |
| parameters: | |
| weight: 1.0 | |
| # PCB策略:限制层影响范围 + 动态竞争平衡 | |
| layers: | |
| - layers: "8-16" | |
| parameter_name: density | |
| value: 0.4 | |
| - layers: "8-16" | |
| parameter_name: epsilon | |
| value: 0.15 | |
| - layers: "8-16" | |
| parameter_name: lambda | |
| value: 1.5 | |
| - layers: "17-24" | |
| parameter_name: density | |
| value: 0.2 | |
| variance_threshold: 0.3 | |
| - model: AlSamCur123/Mistral-Small3-24B-InstructContinuedFine | |
| parameters: | |
| weight: 1.0 | |
| # 强化指令理解层 | |
| layers: | |
| - layers: "0-12" | |
| parameter_name: density | |
| value: 0.7 | |
| - layers: "0-12" | |
| parameter_name: epsilon | |
| value: 0.05 | |
| - layers: "0-12" | |
| parameter_name: lambda | |
| value: 2.0 | |
| variance_threshold: 0.25 | |
| - model: huihui-ai/Mistral-Small-24B-Instruct-2501-abliterated | |
| parameters: | |
| weight: 1.0 | |
| # 基模型参数保护策略 | |
| density: 0.9 | |
| layers: | |
| - layers: "12-24" | |
| parameter_name: density | |
| value: 1.0 | |
| parameters: | |
| global_density: 0.55 # 全局剪裁密度(PCB平衡点) | |
| intra_balance: true | |
| variance_threshold: 0.2 | |
| epsilon_range: [0.1, 0.2] | |
| tokenizer: | |
| source: base | |
| generation_config: | |
| eos_token_id: 2 | |
| pad_token_id: 2 | |
| repetition_penalty: 1.15 | |
| top_k: 40 | |
| temperature: 0.8 | |
| # 参数压缩设置 (目标 12-13B 模型) | |
| architecture: | |
| hidden_size: 3072 # 显著降低 hidden_size (原始 5120 -> 4096 -> 3072) | |
| intermediate_size: 8256 # 相应调整 intermediate_size (比例保持不变) | |
| num_attention_heads: 24 # 相应减少 attention heads (比例保持不变) | |
| num_hidden_layers: 30 # 层数保持 30 层 (适度压缩) | |
| ``` | |