Downloads · 30 days
44
23% of all-time downloads
mudasir13cs/E-commerce-intent-classifier-gguf
E-commerce-intent-classifier-gguf is a machine learning model from mudasir13cs. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This repository contains GGUF format models for efficient inference with llama.cpp.
Downloads · 30 days
44
23% of all-time downloads
All-time downloads
193
Public
Repo size
6.9 GB
Likes
1
Public
Click a slice to open those files.
.gguf6.9 GB · 100%
From the Hugging Face model README
This repository contains GGUF format models for efficient inference with llama.cpp.
Note: This is the GGUF (quantized) version of the model. For the full HuggingFace format model, see the merged model repository.
unsloth/Qwen2.5-1.5B-InstructThe model was fine-tuned on a custom e-commerce dataset containing:
Total: ~10,000 examples from real e-commerce product data (Flipkart, Amazon, MyOnlineShop).
This repository contains multiple quantization levels:
# Clone llama.cpp
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
mkdir build && cd build
cmake .. -DGGML_CUDA=ON
cmake --build . --config Release -j
# Using llama-cli
./llama.cpp/build/bin/llama-cli \
-m path/to/intent-classifier-q4_k_m.gguf \
-p "Context:
Previous search: Smartphones
State: SEARCH_RESULTS
Last command: show_list
Products (6): iPhone 15 Pro, Samsung Galaxy S24, OnePlus 12, Google Pixel 8, Xiaomi 14, Nothing Phone 2
Product count: 6
Query: show me that one"
# Using llama-server (for API access)
./llama.cpp/build/bin/llama-server \
-m path/to/intent-classifier-q4_k_m.gguf \
--port 8080
from llama_cpp import Llama
# Load model
llm = Llama(
model_path="path/to/intent-classifier-q4_k_m.gguf",
n_ctx=2048, # Context window
n_threads=4 # Number of CPU threads
)
# Prepare prompt (ChatML format)
prompt = "<|im_start|>system\nClassify the user's intent based on the query and context. Intent can be: search, show_detail, go_back, or close.<|im_end|>\n<|im_start|>user\nContext:\nPrevious search: Smartphones\nState: SEARCH_RESULTS\nLast command: show_list\nProducts (6): iPhone 15 Pro, Samsung Galaxy S24, OnePlus 12, Google Pixel 8, Xiaomi 14, Nothing Phone 2\nProduct count: 6\n\nQuery: show me that one<|im_end|>\n<|im_start|>assistant\nshow_detail<|im_end|>"
# Generate
response = llm(
prompt,
max_tokens=128,
temperature=0.7,
stop=["<|im_end|>", "<|im_start|>"]
)
print(response['choices'][0]['text'])
Option 1: Using Modelfile (Recommended)
Modelfile:FROM ./intent-classifier-q4_k_m.gguf
TEMPLATE "<|im_start|>system\nClassify the user's intent based on the query and context. Intent can be: search, show_detail, go_back, or close.<|im_end|>\n<|im_start|>user\nContext:\nPrevious search: Smartphones\nState: SEARCH_RESULTS\nLast command: show_list\nProducts (6): iPhone 15 Pro, Samsung Galaxy S24, OnePlus 12, Google Pixel 8, Xiaomi 14, Nothing Phone 2\nProduct count: 6\n\nQuery: show me that one<|im_end|>\n<|im_start|>assistant\nshow_detail<|im_end|>"
PARAMETER temperature 0.7
PARAMETER num_predict 128
PARAMETER stop "<|im_end|>"
PARAMETER stop "<|im_start|>"
ollama create intent-classifier -f Modelfile
Option 2: Direct Import
# Import GGUF file directly
ollama import intent-classifier-q4_k_m.gguf
# Command line
ollama run intent-classifier "Context:
Previous search: Smartphones
State: SEARCH_RESULTS
Last command: show_list
Products (6): iPhone 15 Pro, Samsung Galaxy S24, OnePlus 12, Google Pixel 8, Xiaomi 14, Nothing Phone 2
Product count: 6
Query: show me that one"
# With context
ollama run intent-classifier "Context: Previous search: Smartphones\nQuery: show me that one"
import requests
# Generate
response = requests.post(
"http://localhost:11434/api/generate",
json={
"model": "intent-classifier",
"prompt": "Context:
Previous search: Smartphones
State: SEARCH_RESULTS
Last command: show_list
Products (6): iPhone 15 Pro, Samsung Galaxy S24, OnePlus 12, Google Pixel 8, Xiaomi 14, Nothing Phone 2
Product count: 6
Query: show me that one",
"stream": False,
"options": {
"temperature": 0.7,
"num_predict": 128,
"stop": ["<|im_end|>", "<|im_start|>"]
}
}
)
print(response.json()["response"])
import requests
response = requests.post(
"http://localhost:11434/api/chat",
json={
"model": "intent-classifier",
"messages": [
{"role": "system", "content": "Classify the user's intent based on the query and context. Intent can be: search, show_detail, go_back, or close."},
{"role": "user", "content": "Context:
Previous search: Smartphones
State: SEARCH_RESULTS
Last command: show_list
Products (6): iPhone 15 Pro, Samsung Galaxy S24, OnePlus 12, Google Pixel 8, Xiaomi 14, Nothing Phone 2
Product count: 6
Query: show me that one"}
],
"stream": False
}
)
print(response.json()["message"]["content"])
Note: vLLM works best with HuggingFace format models. Use the merged model instead of GGUF.
pip install vllm
from vllm import LLM, SamplingParams
# Load merged model (not GGUF)
llm = LLM(
model="mudasir13cs/E-commerce-intent-classifier",
trust_remote_code=True,
max_model_len=2048
)
# Prepare prompt
prompt = "<|im_start|>system\nClassify the user's intent based on the query and context. Intent can be: search, show_detail, go_back, or close.<|im_end|>\n<|im_start|>user\nContext:\nPrevious search: Smartphones\nState: SEARCH_RESULTS\nLast command: show_list\nProducts (6): iPhone 15 Pro, Samsung Galaxy S24, OnePlus 12, Google Pixel 8, Xiaomi 14, Nothing Phone 2\nProduct count: 6\n\nQuery: show me that one<|im_end|>\n<|im_start|>assistant\nshow_detail<|im_end|>"
# Sampling parameters
sampling_params = SamplingParams(
temperature=0.7,
max_tokens=128,
stop=["<|im_end|>", "<|im_start|>"]
)
# Generate
outputs = llm.generate([prompt], sampling_params)
print(outputs[0].outputs[0].text)
# Start server
python -m vllm.entrypoints.openai.api_server \
--model mudasir13cs/E-commerce-intent-classifier \
--trust-remote-code \
--port 8000
# Use OpenAI-compatible API
curl http://localhost:8000/v1/completions \
-H "Content-Type: application/json" \
-d '{
"model": "intent-classifier",
"prompt": "Context:
Previous search: Smartphones
State: SEARCH_RESULTS
Last command: show_list
Products (6): iPhone 15 Pro, Samsung Galaxy S24, OnePlus 12, Google Pixel 8, Xiaomi 14, Nothing Phone 2
Product count: 6
Query: show me that one",
"max_tokens": 128,
"temperature": 0.7
}'
Note: TGI works with HuggingFace format models. Use the merged model.
# Using Docker (recommended)
docker pull ghcr.io/huggingface/text-generation-inference:latest
docker run --gpus all \
-p 8080:80 \
-v /path/to/model:/data \
ghcr.io/huggingface/text-generation-inference:latest \
--model-id mudasir13cs/E-commerce-intent-classifier \
--trust-remote-code
from text_generation import Client
client = Client("http://localhost:8080")
response = client.generate(
prompt="<|im_start|>system\nClassify the user's intent based on the query and context. Intent can be: search, show_detail, go_back, or close.<|im_end|>\n<|im_start|>user\nContext:\nPrevious search: Smartphones\nState: SEARCH_RESULTS\nLast command: show_list\nProducts (6): iPhone 15 Pro, Samsung Galaxy S24, OnePlus 12, Google Pixel 8, Xiaomi 14, Nothing Phone 2\nProduct count: 6\n\nQuery: show me that one<|im_end|>\n<|im_start|>assistant\nshow_detail<|im_end|>",
max_new_tokens=128,
temperature=0.7,
stop_sequences=["<|im_end|>", "<|im_start|>"]
)
print(response.generated_text)
Note: Use the merged HuggingFace model for Transformers.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load merged model
model = AutoModelForCausalLM.from_pretrained(
"mudasir13cs/E-commerce-intent-classifier",
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(
"mudasir13cs/E-commerce-intent-classifier",
trust_remote_code=True
)
# Prepare input
messages = [
{"role": "system", "content": "Classify the user's intent based on the query and context. Intent can be: search, show_detail, go_back, or close."},
{"role": "user", "content": "Context:
Previous search: Smartphones
State: SEARCH_RESULTS
Last command: show_list
Products (6): iPhone 15 Pro, Samsung Galaxy S24, OnePlus 12, Google Pixel 8, Xiaomi 14, Nothing Phone 2
Product count: 6
Query: show me that one"}
]
# Apply chat template
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
# Generate
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=128,
temperature=0.7,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
# Decode
response = tokenizer.decode(
outputs[0][inputs.input_ids.shape[1]:],
skip_special_tokens=True
)
print(response)
The model uses ChatML format (Qwen2.5's native format):
<|im_start|>system
Classify the user's intent based on the query and context. Intent can be: search, show_detail, go_back, or close.<|im_end|>
<|im_start|>user
Context:
Previous search: Smartphones
State: SEARCH_RESULTS
Last command: show_list
Products (6): iPhone 15 Pro, Samsung Galaxy S24, OnePlus 12, Google Pixel 8, Xiaomi 14, Nothing Phone 2
Product count: 6
Query: show me that one<|im_end|>
<|im_start|>assistant
show_detail<|im_end|>
System Message:
Classify the user's intent based on the query and context. Intent can be: search, show_detail, go_back, or close.
User Message (Context + Query):
Context:
Previous search: [category]
State: [SEARCH_RESULTS|PRODUCT_DETAIL|INITIAL]
Last command: [show_list|show_item|go_back|close]
Products (N): [product1, product2, ...]
Product count: N
Query: [user query]
Expected Output:
show_detail
Example 1: Pronoun Resolution
Context:
Previous search: Smartphones
State: SEARCH_RESULTS
Last command: show_list
Products (6): iPhone 15 Pro, Samsung Galaxy S24, OnePlus 12, Google Pixel 8, Xiaomi 14, Nothing Phone 2
Product count: 6
Query: show me that one
Example 2: Ellipsis Expansion
Context:
Previous search: Laptops
State: SEARCH_RESULTS
Last command: show_list
Products (5): MacBook Pro, Dell XPS, HP Spectre, Lenovo ThinkPad, ASUS ZenBook
Product count: 5
Query: under 50000
Example 3: Ordinal Reference
Context:
Previous search: Headphones
State: SEARCH_RESULTS
Last command: show_list
Products (4): Sony WH-1000XM5, Bose QuietComfort, AirPods Max, Sennheiser Momentum
Product count: 4
Query: show me the second one
| Format | Size | Quality | Use Case |
|---|---|---|---|
| f16 | ~3GB | Best | Maximum quality, sufficient VRAM |
| q8_0 | ~1.8GB | Excellent | High quality, moderate VRAM |
| q5_k_m | ~1.2GB | Very Good | Balanced quality/size |
| q4_k_m | ~1GB | Good | Smallest size, limited VRAM |
Download the desired quantization level:
# Using huggingface-cli
huggingface-cli download mudasir13cs/E-commerce-intent-classifier-gguf \
intent-classifier-q4_k_m.gguf \
--local-dir ./models
# Or download all formats
huggingface-cli download mudasir13cs/E-commerce-intent-classifier-gguf \
--local-dir ./models
Merged Model (HuggingFace Format): mudasir13cs/E-commerce-intent-classifier
Original LoRA Adapter: See merged model repository for LoRA adapter details
| Backend | Format | Best For | Pros | Cons |
|---|---|---|---|---|
| llama.cpp | GGUF | CPU/GPU inference, edge devices | Fast, low memory, cross-platform | Limited to GGUF format |
| Ollama | GGUF | Local development, easy deployment | Simple API, auto-manages models | Requires model import |
| vLLM | HF | High-throughput serving | Very fast, batching support | Requires HF format, more memory |
| TGI | HF | Production serving | Optimized serving, Docker support | Requires HF format |
| Transformers | HF | Research, fine-tuning | Full flexibility, easy integration | Slower inference, more memory |
If you use this model, please cite:
@software{ecommerce_agent_models,
title = {E-commerce Agent Models - Intent Classifier},
author = {Syed Mudasir},
year = {2025},
url = {https://huggingface.co/mudasir13cs/E-commerce-intent-classifier-gguf}
}
Apache 2.0