Instructions to use bunsenfeng/PFA_switcher_2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bunsenfeng/PFA_switcher_2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bunsenfeng/PFA_switcher_2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("bunsenfeng/PFA_switcher_2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bunsenfeng/PFA_switcher_2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bunsenfeng/PFA_switcher_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": "bunsenfeng/PFA_switcher_2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/bunsenfeng/PFA_switcher_2
- SGLang
How to use bunsenfeng/PFA_switcher_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 "bunsenfeng/PFA_switcher_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": "bunsenfeng/PFA_switcher_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 "bunsenfeng/PFA_switcher_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": "bunsenfeng/PFA_switcher_2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use bunsenfeng/PFA_switcher_2 with Docker Model Runner:
docker model run hf.co/bunsenfeng/PFA_switcher_2
Commit History
-
Improve model card: Add paper details, metadata, and usage for Switch Generation
Verified signatureThis PR significantly improves the model card for the `Switch Generation` model. Key changes include: * Updating the metadata with `pipeline_tag: text-generation` and `license: apache-2.0` for better discoverability and clarity. The `library_name: transformers` has been confirmed based on file evidence (`tokenizer_config.json`, `generation_config.json`, `adapter_config.json`). * Replacing placeholder content with a detailed model description derived from the paper's abstract. * Adding direct links to the research paper ([Don't Throw Away Your Pretrained Model](https://huggingface.co/papers/2510.09913)) and the GitHub repository ([BunsenFeng/switch_generation](https://github.com/BunsenFeng/switch_generation)). * Including the "Quick Start" code snippet directly from the GitHub README to provide immediate, actionable sample usage instructions. * Adding a proper BibTeX citation for the paper. These updates will greatly enhance the model's visibility, provide essential context,…db6532b
-
Upload tokenizer
Verified signaturecf54210
-
Upload LlamaForCausalLM
Verified signature9c40b9f -
initial commit
Verified signatureb0f2c8b