Instructions to use Mrw33554432/bitLinear-phi-1.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mrw33554432/bitLinear-phi-1.5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Mrw33554432/bitLinear-phi-1.5", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Mrw33554432/bitLinear-phi-1.5", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("Mrw33554432/bitLinear-phi-1.5", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Mrw33554432/bitLinear-phi-1.5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Mrw33554432/bitLinear-phi-1.5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mrw33554432/bitLinear-phi-1.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Mrw33554432/bitLinear-phi-1.5
- SGLang
How to use Mrw33554432/bitLinear-phi-1.5 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 "Mrw33554432/bitLinear-phi-1.5" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mrw33554432/bitLinear-phi-1.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Mrw33554432/bitLinear-phi-1.5" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mrw33554432/bitLinear-phi-1.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Mrw33554432/bitLinear-phi-1.5 with Docker Model Runner:
docker model run hf.co/Mrw33554432/bitLinear-phi-1.5
Missing the RMSnorm and activation_quant?
According to the original paper, those 2 components were also being used.
That's true, they are intentionally ignored in current version (since we want to test the performance module by module). I will check my readme to ensure it is clearly noticed.
Another reason is that, if I understand correctly, the activation quant on input and the additional norm would even make the model slower than original model. You won't want to run quantization functions during inference. Based on my test, the model is 2-3x speed during inference by removing the weight quant, which means quantizations significantly influence inference efficiency. I would expect a similar speed drop by applying their activation quant - the model might run faster without it (very likely).
https://github.com/microsoft/BitBLAS
So based on the benchmarks that was reported, there is a significant speed up when using INT8xINT8 (combine 4 2bits params) for BitLinear. I'm running some tests with this to verify. The biggest concern imo is the information loss from quantifying both the inputs and weights with a small model.