Instructions to use AMKCode/gemma-2-2b-it-q4f32_1-MLC with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AMKCode/gemma-2-2b-it-q4f32_1-MLC with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AMKCode/gemma-2-2b-it-q4f32_1-MLC") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AMKCode/gemma-2-2b-it-q4f32_1-MLC", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AMKCode/gemma-2-2b-it-q4f32_1-MLC with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AMKCode/gemma-2-2b-it-q4f32_1-MLC" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AMKCode/gemma-2-2b-it-q4f32_1-MLC", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AMKCode/gemma-2-2b-it-q4f32_1-MLC
- SGLang
How to use AMKCode/gemma-2-2b-it-q4f32_1-MLC 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 "AMKCode/gemma-2-2b-it-q4f32_1-MLC" \ --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": "AMKCode/gemma-2-2b-it-q4f32_1-MLC", "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 "AMKCode/gemma-2-2b-it-q4f32_1-MLC" \ --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": "AMKCode/gemma-2-2b-it-q4f32_1-MLC", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AMKCode/gemma-2-2b-it-q4f32_1-MLC with Docker Model Runner:
docker model run hf.co/AMKCode/gemma-2-2b-it-q4f32_1-MLC
|
Download README.md from AMKCode/gemma-2-2b-it-q4f32_1-MLC: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/AMKCode/gemma-2-2b-it-q4f32_1-MLC/resolve/main/README.md
- Command line
-
hf download hf://AMKCode/gemma-2-2b-it-q4f32_1-MLC/README.md
-
curl -L -o README.md https://huggingface.co/AMKCode/gemma-2-2b-it-q4f32_1-MLC/resolve/main/README.md
1.15 kB
| base_model: google/gemma-2-2b-it | |
| library_name: transformers | |
| license: gemma | |
| pipeline_tag: text-generation | |
| tags: | |
| - conversational | |
| - mlc-ai | |
| - MLC-Weight-Conversion | |
| extra_gated_heading: Access Gemma on Hugging Face | |
| extra_gated_prompt: To access Gemma on Hugging Face, you’re required to review and | |
| agree to Google’s usage license. To do this, please ensure you’re logged in to Hugging | |
| Face and click below. Requests are processed immediately. | |
| extra_gated_button_content: Acknowledge license | |
| # AMKCode/gemma-2-2b-it-q4f32_1-MLC | |
| This model was compiled using MLC-LLM with q4f32_1 quantization from [google/gemma-2-2b-it](https://huggingface.co/google/gemma-2-2b-it). | |
| The conversion was done using the [MLC-Weight-Conversion](https://huggingface.co/spaces/mlc-ai/MLC-Weight-Conversion) space. | |
| To run this model, please first install [MLC-LLM](https://llm.mlc.ai/docs/install/mlc_llm.html#install-mlc-packages). | |
| To chat with the model on your terminal: | |
| ```bash | |
| mlc_llm chat HF://AMKCode/gemma-2-2b-it-q4f32_1-MLC | |
| ``` | |
| For more information on how to use MLC-LLM, please visit the MLC-LLM [documentation](https://llm.mlc.ai/docs/index.html). | |