Instructions to use ekshat/zephyr_7b_q4_k_m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ekshat/zephyr_7b_q4_k_m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ekshat/zephyr_7b_q4_k_m") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ekshat/zephyr_7b_q4_k_m") model = AutoModelForCausalLM.from_pretrained("ekshat/zephyr_7b_q4_k_m") 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]:])) - llama-cpp-python
How to use ekshat/zephyr_7b_q4_k_m with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="ekshat/zephyr_7b_q4_k_m", filename="unsloth.F16.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use ekshat/zephyr_7b_q4_k_m with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ekshat/zephyr_7b_q4_k_m:F16 # Run inference directly in the terminal: llama-cli -hf ekshat/zephyr_7b_q4_k_m:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf ekshat/zephyr_7b_q4_k_m:F16 # Run inference directly in the terminal: llama-cli -hf ekshat/zephyr_7b_q4_k_m:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf ekshat/zephyr_7b_q4_k_m:F16 # Run inference directly in the terminal: ./llama-cli -hf ekshat/zephyr_7b_q4_k_m:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf ekshat/zephyr_7b_q4_k_m:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf ekshat/zephyr_7b_q4_k_m:F16
Use Docker
docker model run hf.co/ekshat/zephyr_7b_q4_k_m:F16
- LM Studio
- Jan
- vLLM
How to use ekshat/zephyr_7b_q4_k_m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ekshat/zephyr_7b_q4_k_m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ekshat/zephyr_7b_q4_k_m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ekshat/zephyr_7b_q4_k_m:F16
- SGLang
How to use ekshat/zephyr_7b_q4_k_m 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 "ekshat/zephyr_7b_q4_k_m" \ --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": "ekshat/zephyr_7b_q4_k_m", "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 "ekshat/zephyr_7b_q4_k_m" \ --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": "ekshat/zephyr_7b_q4_k_m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use ekshat/zephyr_7b_q4_k_m with Ollama:
ollama run hf.co/ekshat/zephyr_7b_q4_k_m:F16
- Unsloth Studio new
How to use ekshat/zephyr_7b_q4_k_m with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ekshat/zephyr_7b_q4_k_m to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ekshat/zephyr_7b_q4_k_m to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for ekshat/zephyr_7b_q4_k_m to start chatting
- Docker Model Runner
How to use ekshat/zephyr_7b_q4_k_m with Docker Model Runner:
docker model run hf.co/ekshat/zephyr_7b_q4_k_m:F16
- Lemonade
How to use ekshat/zephyr_7b_q4_k_m with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ekshat/zephyr_7b_q4_k_m:F16
Run and chat with the model
lemonade run user.zephyr_7b_q4_k_m-F16
List all available models
lemonade list
llm.create_chat_completion(
messages = [
{
"role": "user",
"content": "What is the capital of France?"
}
]
)Overview
The Zephyr 7B model is a cutting-edge language model designed for robust natural language understanding and generation. It is suitable for a variety of NLP tasks, such as text generation, summarization, translation, and question answering. This repository hosts both the standard and quantized versions of the Zephyr 7B model, allowing users to choose the version that best fits their resource constraints and performance needs.
Model Details
- Model Name: Zephyr 7B
- Model Size: 7 billion parameters
- Architecture: Transformer-based
- Languages: Primarily English, with support for multilingual text
- Quantized Version: Available for reduced memory footprint and faster inference
Usage
Installation
To use the Zephyr 7B model, install the transformers library:
pip install transformers
Loading the Model
Load the model using the transformers library as follows:
Standard Version
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "ekshat/zephyr_7b_q4_k_m"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
Quantized Version
Using Ollama, .gguf model can be used on local system. For more details, refer Ollama
Generating Text
Generate text with the Zephyr 7B model:
input_text = "Once upon a time"
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(inputs.input_ids, max_length=50)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
Performance and Efficiency
The quantized version of Zephyr 7B is optimized for environments with limited computational resources. It offers:
- Reduced Memory Usage: The model size is significantly smaller, making it suitable for deployment on devices with limited RAM.
- Faster Inference: Quantized models can perform faster inference, providing quicker responses in real-time applications.
Fine-Tuning
You can fine-tune the Zephyr 7B model on your own dataset to better suit specific tasks or domains. Refer to the Huggingface documentation for guidance on how to fine-tune transformer models.
Contributing
We welcome contributions to improve the Zephyr 7B model. Please submit pull requests or open issues for any enhancements or bugs you encounter.
License
This model is licensed under the MIT License.
Acknowledgments
Special thanks to the Huggingface team for providing the transformers library and to the broader AI community for their continuous support and contributions.
Contact
For any questions or inquiries, please contact us at (mailto:akshayhedaoo7246@gmail.com).
We hope you find the Zephyr 7B model useful for your NLP tasks. Happy coding!
- Downloads last month
- 14
4-bit
16-bit
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="ekshat/zephyr_7b_q4_k_m", filename="", )