CoolFace
Modelpublic

Aya-In-Brooklyn/spaCy-roberta-workout-entity-model

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes
Model Card

Low-Latency Voice-to-NLP Recommender (NER) — RoBERTa Fine-Tuned

Fine-tuned roberta-base spaCy model for extracting fitness-related entities from voice-transcribed or free-text user queries. Trained on 30,000+ synthetic ASR-style queries using TransformerListener and TransitionBasedParser architecture.


Model Overview

  • —Entities:
  • —WORKOUT_TYPE, DURATION, INSTRUCTOR, INTENSITY, GOAL, MOOD
  • —Base Model: roberta-base
  • —spaCy Components:
  • —spacy-transformers.TransformerListener.v1 with RoBERTa upstream
  • —spacy.TransitionBasedParser.v2
  • —Training Data:
  • —30,000+ unique ASR-simulated fitness queries
  • —Covers realistic variations in duration, mood, intensity, goal, instructor, and type
  • —Evaluation:
  • —Overall NER F1 Score: 99.97%
  • —Token Accuracy: 100%
  • —Evaluation performed on a held-out dev set

Architecture

Input Processing:

  1. 1.spaCy Tokenization (custom whitespace and rule-based split)
  2. 2.RoBERTa Tokenizer (subword-level BPE tokenization)
  3. 3.Embedding Layer (lookup table to 768-dimensional dense vectors)
  4. 4.Transformer Encoder (multi-head self-attention and feedforward blocks)
  5. 5.TransformerListener:
  6. 6.Pools subword embeddings to align with spaCy tokens
  7. 7.reduce_mean.v1 pooling used for subword combinations
  8. 8.TransitionBasedParser (NER Decoder):
  9. 9.Projects token vectors (768 → 128 hidden units)
  10. 10.Applies maxout layers and span transition modeling
  11. 11.Predicts BIO-tag labels per token

Training Configuration:

  • —Optimizer: Adam with weight decay
  • —Learning Rate: 1e-4
  • —Weight Decay (L2 Regularization): 0.01
  • —Dropout: 0.15
  • —Maxout Pieces: 2
  • —Mixed Precision: Enabled (AMP)

Usage

Install the required packages:

bash
pip install spacy spacy-transformers

Load the fine-tuned model:

python
import spacy

nlp = spacy.load("Aya-In-Brooklyn/fitness_entity_extractor_ner_roberta_finetuned")

doc = nlp("Find me a 45 minute yoga class with Alex.")

for ent in doc.ents:
    print(ent.text, ent.label_)

Example Output:

plaintext
45 minute -> DURATION
yoga -> WORKOUT_TYPE
Alex -> INSTRUCTOR

Training Details

  • —Loss Function: Categorical Cross-Entropy over entity labels
  • —Span Construction:
  • —BIO (Begin, Inside, Outside) tagging
  • —State transitions between spans handled with a transition-based system
  • —Evaluation Metrics:
  • —Precision (P), Recall (R), F1 Score (F) for each entity type
  • —Entity-level (not token-level) evaluation
  • —Batcher:
  • —batch_by_words.v1, size tolerance 20%
  • —Maximum batch size: 2048 words

Training was tracked and logged with MLflow for full reproducibility.


Model Evaluation (Detailed)

Entity TypePrecision (%)Recall (%)F1 Score (%)
WORKOUT_TYPE100.00100.00100.00
INSTRUCTOR100.0099.9499.97
INTENSITY99.73100.0099.86
GOAL100.00100.00100.00
DURATION100.0099.9499.97
MOOD100.0099.7999.90
  • —Overall NER F1: 99.97%
  • —Inference Speed: ~5950 tokens/sec on single GPU

Source Structure

  • —config_filled.cfg: Full model training configuration
  • —voice_assistant/models/entity/model-last/: Saved fine-tuned spaCy model
  • —voice_assistant/data/entity_data/: Training and development datasets
  • —MLflow artifacts: Logged metrics and parameters for training reproducibility

Deployment

Model is ready to be pushed to Hugging Face Hub or integrated into production systems via:

python
import spacy
nlp = spacy.load("Aya-In-Brooklyn/fitness_entity_extractor_ner_roberta_finetuned")

Notes

  • —This model assumes ASR-style, noisy voice queries.
  • —Designed for realistic, imperfect, user-facing voice systems.
  • —No manual rule-based extraction is applied; pure end-to-end learning from labeled spans.