NEED AI Conversational Model
Multi-task conversational AI model for the NEED service marketplace platform.
Model Description
This model performs three simultaneous tasks:
- Intent Classification - Identifies user intent (10 classes)
- Category Classification - Classifies service category (20 classes)
- Response Generation - Generates contextual responses
Architecture
- Type: Custom Transformer (Encoder-Decoder)
- Parameters: ~95.9M
- Dimensions: 512 (model), 6 layers, 8 heads
- Vocabulary: 50,257 tokens (GPT-2 tokenizer)
- Context Length: 512 tokens
Usage
Installation
pip install torch transformers huggingface_hub
Loading the Model
import torch
from transformers import AutoTokenizer
from huggingface_hub import hf_hub_download
# Download model and custom code
model_path = hf_hub_download(repo_id="yogami9/need-ai-conversational-model", filename="pytorch_model.bin")
modeling_path = hf_hub_download(repo_id="yogami9/need-ai-conversational-model", filename="modeling_need.py")
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("yogami9/need-ai-conversational-model")
# Import and load model
import sys
import os
sys.path.insert(0, os.path.dirname(modeling_path))
from modeling_need import NEEDConversationalModel
model = NEEDConversationalModel.from_pretrained(model_path)
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = model.to(device)
model.eval()
Inference Example
def generate_response(text: str, max_length: int = 100):
# Prepare input
input_text = f"Human: {text}"
input_ids = tokenizer.encode(input_text, return_tensors='pt').to(device)
speaker_ids = torch.zeros_like(input_ids) # Human speaker
# Generate
with torch.no_grad():
output_ids = model.generate(
input_ids=input_ids,
speaker_ids=speaker_ids,
max_length=max_length,
temperature=0.8,
top_k=50
)
# Decode
response = tokenizer.decode(output_ids[0], skip_special_tokens=True)
return response
# Test
response = generate_response("I need a house cleaner in Lagos")
print(response)
Training Data
Trained on conversations from the NEED service marketplace covering:
- Service requests and inquiries
- Pricing questions
- Location-based queries
- Booking requests
- Category navigation help
Languages: English (Nigerian context)
Training Details
- Framework: PyTorch
- Training Hardware: Google Colab (Tesla T4 GPU)
- Optimizer: AdamW (lr=5e-5, weight_decay=0.01)
- Scheduler: CosineAnnealingLR
- Batch Size: 2-4
- Epochs: 3+ (early stopping)
Limitations
- Trained primarily on Nigerian English context
- Limited to 512 token context window
- May require fine-tuning for other domains
- Custom architecture requires manual loading
Intended Use
Primary: Customer service automation for NEED platform
Suitable for:
- Service request routing
- Basic customer support
- Intent detection
- Category recommendation
Not suitable for:
- Medical/legal advice
- Financial transactions
- High-stakes decision making
Citation
@misc{need-ai-2025,
title={NEED AI Conversational Model},
author={NEED Service App Team},
year={2025},
publisher={Hugging Face},
url={https://huggingface.co/yogami9/need-ai-conversational-model}
}
Contact
- Email: [email protected]
- Repository: GitHub
License
Apache 2.0
- Downloads last month
- 3