Instructions to use pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON") model = AutoModelForCausalLM.from_pretrained("pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - llama-cpp-python
How to use pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON", filename="SmolLM2-360M-Instruct-Text-2-JSON.F16.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON:F16 # Run inference directly in the terminal: llama-cli -hf pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON:F16 # Run inference directly in the terminal: llama-cli -hf pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON:F16 # Run inference directly in the terminal: ./llama-cli -hf pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON:F16
Use Docker
docker model run hf.co/pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON:F16
- LM Studio
- Jan
- vLLM
How to use pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON:F16
- SGLang
How to use pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON 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 "pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON" \ --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": "pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON", "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 "pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON" \ --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": "pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON with Ollama:
ollama run hf.co/pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON:F16
- Unsloth Studio new
How to use pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON to start chatting
- Docker Model Runner
How to use pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON with Docker Model Runner:
docker model run hf.co/pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON:F16
- Lemonade
How to use pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON:F16
Run and chat with the model
lemonade run user.SmolLM2-360M-Instruct-Text-2-JSON-F16
List all available models
lemonade list
Developed by: Pramod Koujalagi
SmolLM2-360M-Instruct-Text-2-JSON
A fine-tuned version of SmolLM2-360M-Instruct-bnb-4bit specialized for parsing unstructured calendar event requests into structured JSON data.
Model Description
This model is fine-tuned on SmolLM2-360M-Instruct-bnb-4bit using QLoRA to extract structured calendar event information from natural language text. It identifies and structures key scheduling entities like action, date, time, attendees, location, duration, recurrence, and notes.
📦 Example Usage
You can use the SmolLM2-360M-Instruct-Text-2-JSON model to parse natural language event descriptions into structured JSON format.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
import json
# Load model and tokenizer
model_name = "pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
def parse_calendar_event(text):
# Format the prompt
formatted_prompt = f"""<|im_start|>user
Extract the relevant event information from this text and organize it into a JSON structure with fields for action, date, time, attendees, location, duration, recurrence, and notes. If a field is not present, return null for that field.
Text: {text}
<|im_end|>
<|im_start|>assistant
"""
# Generate response
inputs = tokenizer(formatted_prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
do_sample=True,
temperature=0.1,
top_p=0.95,
pad_token_id=tokenizer.eos_token_id
)
# Process response
output_text = tokenizer.decode(outputs[0], skip_special_tokens=False)
response = output_text.split("<|im_start|>assistant\n")[1].split("<|im_end|>")[0].strip()
# Return formatted JSON
parsed_json = json.loads(response)
return json.dumps(parsed_json, indent=2)
# Example input
event_text = "Plan an exhibition walkthrough on 15th, April 2028 at 3 PM with Harper, Grace, and Alex in the art gallery for 1 hour, bring bag."
# Output
print("Prompt:")
print(event_text)
print("\nModel Output:")
print(parse_calendar_event(event_text))
Output
Prompt:
Plan an exhibition walkthrough on 15th, April 2028 at 3 PM with Harper, Grace, and Alex in the art gallery for 1 hour, bring bag.
Model Output:
{
"action": "Plan an exhibition walkthrough",
"date": "15/04/2028",
"time": "3:00 PM",
"attendees": [
"Harper",
"Grace",
"Alex"
],
"location": "art gallery",
"duration": "1 hour",
"recurrence": null,
"notes": "Bring bag"
}
Resources for more information:
- GitHub Repository: SmolLM2-360M-Instruct-Text-2-JSON
- Base Model: SmolLM2-360M-Instruct-bnb-4bit (Derived from HuggingfaceTB/SmolLM2-360)
Use Cases
- Calendar application integration
- Personal assistant scheduling systems
- Meeting summarization tools
- Email processing for event extraction
Training Details
Training Data
The model was trained on a custom dataset consisting of 1,149 examples (1,034 training, 115 validation) of natural language event descriptions paired with structured JSON outputs. The dataset includes a wide variety of event types, date/time formats, and varying combinations of fields.
Training Procedure
- Fine-tuning method: QLoRA (Quantized Low-Rank Adaptation)
- LoRA configuration:
- Rank: 64
- Alpha: 32
- Target modules: All key model components
- Rank-stabilized LoRA: Enabled
- Training hyperparameters:
- Batch size: 8 (2 per device × 4 gradient accumulation steps)
- Learning rate: 2e-4 with cosine scheduler
- Epochs: 3
- Weight decay: 0.01
- Optimizer: AdamW (8-bit)
- Gradient checkpointing: Enabled
- Training time: ~15 minutes
- Hardware used: T4 GPU
Training Metrics
- Final training loss:
- Final validation loss:
- Validation perplexity: 1.2091
- Downloads last month
- 1,247
4-bit
16-bit
Model tree for pramodkoujalagi/SmolLM2-360M-Instruct-Text-2-JSON
Base model
HuggingFaceTB/SmolLM2-360M