Instructions to use Amu/spin-phi2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Amu/spin-phi2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Amu/spin-phi2", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Amu/spin-phi2", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("Amu/spin-phi2", trust_remote_code=True) 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 Amu/spin-phi2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Amu/spin-phi2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Amu/spin-phi2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Amu/spin-phi2
- SGLang
How to use Amu/spin-phi2 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 "Amu/spin-phi2" \ --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": "Amu/spin-phi2", "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 "Amu/spin-phi2" \ --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": "Amu/spin-phi2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Amu/spin-phi2 with Docker Model Runner:
docker model run hf.co/Amu/spin-phi2
Please ad finetune / chat model tag
Is this not a finetune? Why does it have the "pretrained" tag?
Please consider changing the tag as people might get the wrong idea. If I understand SPIN right, then this is NOT a "pretrained" model as defined by the leaderboard with "new, base models, trained on a given text corpora using masked modelling", as SPIN involves a reward function derived from a finetuning dataset, which in this case is the ultrachat_200k dataset. Instead, the chat model tag might fit better.
Is this not a finetune? Why does it have the "pretrained" tag?
Please consider changing the tag as people might get the wrong idea. If I understand SPIN right, then this is NOT a "pretrained" model as defined by the leaderboard with "new, base models, trained on a given text corpora using masked modelling", as SPIN involves a reward function derived from a finetuning dataset, which in this case is the ultrachat_200k dataset. Instead, the chat model tag might fit better.
Hi, thanks for your advice. Do you know how how to change the tag? I try to resubmit to the llm leaderboard to change the tag. But it said that 'This model has been already submitted.'.
You can open a pull-request to your models submitted to the leaderboard by modifying the request file via the "contribute" button: https://huggingface.co/datasets/open-llm-leaderboard/requests/tree/main/amu
You can open a pull-request to your models submitted to the leaderboard by modifying the request file via the "contribute" button: https://huggingface.co/datasets/open-llm-leaderboard/requests/tree/main/amu
https://huggingface.co/datasets/open-llm-leaderboard/requests/discussions/84 I has opened a pr for it. It seems ok. Thank you again!
Thank you and you are welcome :-)