Instructions to use alpindale/WizardLM-2-8x22B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use alpindale/WizardLM-2-8x22B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="alpindale/WizardLM-2-8x22B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("alpindale/WizardLM-2-8x22B") model = AutoModelForCausalLM.from_pretrained("alpindale/WizardLM-2-8x22B") 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]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use alpindale/WizardLM-2-8x22B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "alpindale/WizardLM-2-8x22B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "alpindale/WizardLM-2-8x22B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/alpindale/WizardLM-2-8x22B
- SGLang
How to use alpindale/WizardLM-2-8x22B 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 "alpindale/WizardLM-2-8x22B" \ --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": "alpindale/WizardLM-2-8x22B", "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 "alpindale/WizardLM-2-8x22B" \ --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": "alpindale/WizardLM-2-8x22B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use alpindale/WizardLM-2-8x22B with Docker Model Runner:
docker model run hf.co/alpindale/WizardLM-2-8x22B
This model is amazingly good but seems lost in the `llama 3` hype :(
This model seems to have been lost in all the hype of llama 3 but IMO it's actually the current best open LLM for coding so far - much better than the official mixtral-instructfrom my testing.
It's especially good at refactoring code: other models I always have to break up the work for them or else they get confused or just rename a few variables, etc; this seems to make its own plan and really do a thorough job of refactoring!
I'm not sure why the official mixtral-instructis so much worse as previously with the 8x7b mixtral-instructit was the other way round and no fine tunes were as good... My Q4_K_Sof the official mixtral-instructalso seems to randomly stop and there are reports of other weirdness in the HF discussions for the non-quantized version too.
https://reddit.com/comments/1c9s4mf/comment/l0no0y9
... I did notice that the together.ai version does have this strange tendency to cut off its answer with a few sentences left in its response. I can get past this simply by typing "more" but it is a bit annoying when it happens over and over.
Strange he gets this with this model too! I wonder if there is a bug in the conversion from HF or even a bug in the original HF json files causing this?
https://reddit.com/comments/1c9s4mf/comment/l0oo08b
It just wasn't worth the headache for a marginal improvement over just something like "Answer the following question:". I typically find having at least that much of a system prompt helps some models from not just ending immediately or going off on a tangent.
I can't tell if he's referring to wizard-lm-2specifically in this post or if the "ending immediately" refers to the same problem manifestation, but interestingly I didn't use a system prompt so will try that for the official mixtral-instructnow too.