smart-catalog-bot / README.md
ryanfrancis's picture
Update README.md
5a3fae3 verified
|
Raw
History Blame Contribute Delete
3.02 kB
metadata
tags:
  - text-generation
  - peft
  - lora
  - e-commerce
  - tinyllama
widget:
  - text: >-
      Product Description: A sleek, stainless steel smart watch with heart rate
      tracking and a breathable silicone strap, perfect for outdoor runners.

      Tags:
    example_title: Smart Watch
  - text: >-
      Product Description: A heavy-duty, waterproof winter coat with a faux-fur
      lined hood and deep pockets for snowboarding.

      Tags:
    example_title: Winter Coat

πŸ€– Smart Catalog Bot: E-Commerce Tagging Assistant

πŸ“Œ Overview

This is a fine-tuned LoRA adapter for TinyLlama/TinyLlama-1.1B-Chat-v1.0. It has been specifically instruction-tuned to act as an automated, highly structured parser for e-commerce product catalogs.

Standard open-source Large Language Models often hallucinate conversational filler (e.g., "Here are your tags..."). This model was trained to abandon conversational outputs entirely and strictly generate API-ready metadata tags based on unstructured product descriptions.

πŸ—οΈ Model Details

  • Developer: Ryan Francis
  • Model Type: Causal Language Model (LoRA Fine-Tune)
  • Base Model: TinyLlama 1.1B
  • Language: English
  • Primary Use Case: Automated e-commerce pipeline categorization

βš™οΈ Training Methodology

The model was fine-tuned on a synthetically generated dataset of 100 diverse, unstructured e-commerce product descriptions. It was trained to map these descriptions to a rigid output schema: [Category: X] [Target: Y] [Material/Style: Z].

  • Training Regime: fp16 mixed precision natively on a T4 GPU
  • Technique: Parameter-Efficient Fine-Tuning (PEFT) via LoRA
  • Target Modules: q_proj, v_proj
  • Optimizer: adamw_torch

πŸ“Š Evaluation and Validation

The model was evaluated using a Format Compliance Rate metric. On unseen validation prompts, the fine-tuned adapter achieved strict structural adherence, successfully outputting the exact requested bracketed format with zero conversational hallucinations.

πŸ’» How to Use This Model

You can load this model and run inference using the peft and transformers libraries.

import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

# 1. Load the base model
base_model_id = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(base_model_id, device_map="auto", torch_dtype=torch.float16)

# 2. Load the fine-tuned adapter
repo_id = "ryanfrancis/smart-catalog-bot"
model = PeftModel.from_pretrained(model, repo_id)

# 3. Test the model
prompt = "Product Description: A low-profile velvet sofa in emerald green with tapered wooden legs, perfect for a mid-century modern living room.\nTags:"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")

# Generate with low temperature for strict formatting
outputs = model.generate(**inputs, max_new_tokens=40, temperature=0.1)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))