Downloads · 30 days
19
8% of all-time downloads
barathsmart/smollm-360m-event-extraction
smollm-360m-event-extraction is a text generation model from barathsmart. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
SmolLM-360M fine-tuned for calendar event entity extraction. Extracts structured information from natural language event descriptions.
Downloads · 30 days
19
8% of all-time downloads
All-time downloads
242
Public
Parameters
362M
1.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.4 GB · 100%
From the Hugging Face model README
SmolLM-360M fine-tuned for calendar event entity extraction.
Extracts structured information from natural language event descriptions.
This model extracts the following entities from calendar event descriptions:
from transformers import AutoTokenizer, AutoModelForCausalLM
import json
# Load model and tokenizer
model_name = "smollm-360m-event-extraction"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
# Example event text
event_text = "Team meeting tomorrow at 2pm with John and Sarah for 1 hour"
# Create prompt
prompt = f'''Extract the following entities from the calendar event description:
Event: {event_text}
Please provide the extracted information in this exact JSON format:
{{
"action": "extracted action or null",
"date": "extracted date or null",
"time": "extracted time or null",
"attendees": ["list of attendees"] or null,
"location": "extracted location or null",
"duration": "extracted duration or null",
"recurrence": "extracted recurrence or null",
"notes": "extracted notes or null"
}}
Extracted entities:'''
# Tokenize and generate
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=200, temperature=0.1)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
# Extract and parse JSON
generated_json = response[len(prompt):].strip()
entities = json.loads(generated_json)
print(entities)
def extract_entities_batch(event_texts, model, tokenizer):
results = []
for event_text in event_texts:
# Use the same prompt format as above
# ... (generation code)
results.append(entities)
return results
"Team meeting tomorrow at 2pm with John and Sarah for 1 hour"
{
"action": "Team meeting",
"date": "tomorrow",
"time": "2pm",
"attendees": ["John", "Sarah"],
"location": null,
"duration": "1 hour",
"recurrence": null,
"notes": null
}