Instructions to use MathAndMagic/polaris-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MathAndMagic/polaris-small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MathAndMagic/polaris-small", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MathAndMagic/polaris-small") model = AutoModelForCausalLM.from_pretrained("MathAndMagic/polaris-small", 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 MathAndMagic/polaris-small with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MathAndMagic/polaris-small" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MathAndMagic/polaris-small", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MathAndMagic/polaris-small
- SGLang
How to use MathAndMagic/polaris-small 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 "MathAndMagic/polaris-small" \ --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": "MathAndMagic/polaris-small", "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 "MathAndMagic/polaris-small" \ --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": "MathAndMagic/polaris-small", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MathAndMagic/polaris-small with Docker Model Runner:
docker model run hf.co/MathAndMagic/polaris-small
Update README.md
Browse files
README.md
CHANGED
|
@@ -25,7 +25,11 @@ This model was developed by StarfleetAI with the aim of it being used for autono
|
|
| 25 |
|
| 26 |
## Current Features
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
- Able to call functions
|
| 31 |
- Not bad at coding tasks
|
|
@@ -92,10 +96,10 @@ For now, the model is only capable of calling one function at a time.
|
|
| 92 |
|
| 93 |
## Function Call Response
|
| 94 |
|
| 95 |
-
The model expects the function call response to be provided right after the function call request from a role `
|
| 96 |
|
| 97 |
```
|
| 98 |
-
<|im_start|>
|
| 99 |
{"result": "87cc47fbc865a290d7c7de4be3c893175c51a566b3"}<|im_end|>
|
| 100 |
```
|
| 101 |
|
|
@@ -122,7 +126,7 @@ You are a helpful assistant.<|im_end|>
|
|
| 122 |
Generate a password, 42 characters long<|im_end|>
|
| 123 |
<|im_start|>assistant
|
| 124 |
<|fn_start|>{"name": "generate_password", "arguments": {"length": 42}}<|fn_end|><|im_end|>
|
| 125 |
-
<|im_start|>
|
| 126 |
{"result": "87cc47fbc865a290d7c7de4be3c893175c51a566b3"}<|im_end|>
|
| 127 |
<|im_start|>assistant
|
| 128 |
Here is your random password: 87cc47fbc865a290d7c7de4be3c893175c51a566b3. Please make sure to save it in a secure place.<|im_end|>
|
|
|
|
| 25 |
|
| 26 |
## Current Features
|
| 27 |
|
| 28 |
+
### `v0.1.1`
|
| 29 |
+
|
| 30 |
+
- Function call response role changed to `tool` to comply with OpenAI
|
| 31 |
+
|
| 32 |
+
### `v0.1`
|
| 33 |
|
| 34 |
- Able to call functions
|
| 35 |
- Not bad at coding tasks
|
|
|
|
| 96 |
|
| 97 |
## Function Call Response
|
| 98 |
|
| 99 |
+
The model expects the function call response to be provided right after the function call request from a role `tool`:
|
| 100 |
|
| 101 |
```
|
| 102 |
+
<|im_start|>tool
|
| 103 |
{"result": "87cc47fbc865a290d7c7de4be3c893175c51a566b3"}<|im_end|>
|
| 104 |
```
|
| 105 |
|
|
|
|
| 126 |
Generate a password, 42 characters long<|im_end|>
|
| 127 |
<|im_start|>assistant
|
| 128 |
<|fn_start|>{"name": "generate_password", "arguments": {"length": 42}}<|fn_end|><|im_end|>
|
| 129 |
+
<|im_start|>tool
|
| 130 |
{"result": "87cc47fbc865a290d7c7de4be3c893175c51a566b3"}<|im_end|>
|
| 131 |
<|im_start|>assistant
|
| 132 |
Here is your random password: 87cc47fbc865a290d7c7de4be3c893175c51a566b3. Please make sure to save it in a secure place.<|im_end|>
|