Instructions to use Shresth12345/entity-extraction-smollm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Shresth12345/entity-extraction-smollm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Shresth12345/entity-extraction-smollm")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Shresth12345/entity-extraction-smollm") model = AutoModelForCausalLM.from_pretrained("Shresth12345/entity-extraction-smollm") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Shresth12345/entity-extraction-smollm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Shresth12345/entity-extraction-smollm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Shresth12345/entity-extraction-smollm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Shresth12345/entity-extraction-smollm
- SGLang
How to use Shresth12345/entity-extraction-smollm 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 "Shresth12345/entity-extraction-smollm" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Shresth12345/entity-extraction-smollm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Shresth12345/entity-extraction-smollm" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Shresth12345/entity-extraction-smollm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Shresth12345/entity-extraction-smollm with Docker Model Runner:
docker model run hf.co/Shresth12345/entity-extraction-smollm
Entity Extraction Model - Fine-tuned SmolLM-360M
This model is a fine-tuned version of HuggingFaceTB/SmolLM-360M for extracting structured entities from natural language calendar event descriptions.
Model Description
- Base Model: HuggingFaceTB/SmolLM-360M
- Task: Entity Extraction for Calendar Events
- Language: English
- License: Apache 2.0
Intended Use
This model extracts structured entities from natural language text describing calendar events. It outputs JSON with the following fields:
action: Type of event (e.g., "meeting", "lunch")date: Date in DD/MM/YYYY formattime: Time in HH:MM AM/PM formatattendees: Array of attendee names (or null)location: Event location (or null)duration: Duration description (or null)recurrence: Recurrence pattern (or null)notes: Additional notes (or null)
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
model_name = "Shresth12345/entity-extraction-smollm"
model = AutoModelForCausalLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Example usage
text = "Meeting with John tomorrow at 2pm for 1 hour at the office"
prompt = f"Extract entities from: {text}"
# Tokenize and generate
inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=150,
temperature=0.1,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
# Decode response
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
generated_text = response[len(prompt):].strip()
print(generated_text)
Expected Output Format
{
"action": "Meeting",
"date": "tomorrow",
"time": "2:00 PM",
"attendees": ["John"],
"location": "office",
"duration": "1 hour",
"recurrence": null,
"notes": null
}
Training Details
- Training Data: 793 calendar event samples
- Training Split: 70% train, 15% validation, 15% test
- Custom Loss Function: Entity-aware loss with weighted output portion
- Training Framework: PyTorch (custom trainer)
- Evaluation Metrics: Exact match accuracy, field-wise accuracy, JSON quality
Model Performance
The model demonstrates strong performance in:
- Accurate entity extraction from natural language
- Consistent JSON output format
- Handling of missing/null values
- Recognition of temporal expressions
- Identification of people and locations
Limitations
- Primarily trained on English calendar events
- May struggle with very complex or ambiguous temporal expressions
- Performance may vary with domain-specific terminology
- Requires specific input format: "Extract entities from: [text]"
Training Procedure
This model was fine-tuned using:
- Custom PyTorch trainer implementation
- Entity-weighted loss function (weight: 2.0)
- Cosine annealing learning rate schedule
- Gradient accumulation for effective larger batch sizes
- Early stopping based on validation performance
Citation
If you use this model, please cite:
@misc{entity-extraction-smollm,
title={Entity Extraction Fine-tuned SmolLM-360M},
author={Shresth Mishra},
year={2025},
howpublished={\url{https://huggingface.co/Shresth12345/entity-extraction-smollm}}
}
Contact
For questions about this model, please open an issue in the repository or contact the author.
- Downloads last month
- 1
Model tree for Shresth12345/entity-extraction-smollm
Base model
HuggingFaceTB/SmolLM-360M