Commit ·
1e871c4
1
Parent(s): d272f1c
Add hf-jobs tag to README frontmatter
Browse filesStandardizing metadata tags across uv-scripts organization
for better discoverability of HF Jobs-compatible scripts.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
12334567889101120 unmodified lines323334353536373887 unmodified lines1261271281291291301311321331341351364 unmodified lines14114214314014414514614714814915015114414515215315415515615715115815916016116216316416521 unmodified lines18718818917919019119219319419519622 unmodified lines21922022120820921021121222222322422522622720 unmodified lines248249250239251252253254255256257258259260---viewer: falsetags: [uv-script, classification, vllm, structured-outputs, gpu-required]tags: [uv-script, classification, vllm, structured-outputs, gpu-required, hf-jobs]---
# Dataset Classification Script
GPU-accelerated text classification for Hugging Face datasets with guaranteed valid outputs through structured generation.GPU-accelerated text classification for Hugging Face datasets with guaranteed valid outputs through structured generation. Powered by SmolLM3-3B's advanced reasoning capabilities.
## 🚀 Quick Start
20 unmodified lines- **Guaranteed valid outputs** using structured generation with guided decoding- **Zero-shot classification** without training data required- **GPU-optimized** for maximum throughput and efficiency- **Default model**: HuggingFaceTB/SmolLM3-3B (fast 3B model with thinking capabilities)- **Default model**: [HuggingFaceTB/SmolLM3-3B](https://huggingface.co/HuggingFaceTB/SmolLM3-3B) - a fast 3B model with native thinking capabilities (`<think>` tags)- **Robust text handling** with preprocessing and validation- **Automatic progress tracking** and detailed statistics- **Direct Hub integration** - read and write datasets seamlessly87 unmodified lines### Support Ticket Classification
```bashuv run classify-dataset.py \# Run on HF Jobs with SmolLM3-3B (default)hf jobs uv run \ --flavor l4x1 \ --image vllm/vllm-openai:latest \ https://huggingface.co/datasets/uv-scripts/classification/raw/main/classify-dataset.py \ --input-dataset user/support-tickets \ --column content \ --labels "bug,feature_request,question,other" \4 unmodified lines### News Categorization
```bashuv run classify-dataset.py \# Using SmolLM3-3B for efficient news classificationhf jobs uv run \ --flavor l4x1 \ --image vllm/vllm-openai:latest \ https://huggingface.co/datasets/uv-scripts/classification/raw/main/classify-dataset.py \ --input-dataset ag_news \ --column text \ --labels "world,sports,business,tech" \ --output-dataset user/ag-news-categorized \ --model meta-llama/Llama-3.2-3B-Instruct --output-dataset user/ag-news-categorized```
### Complex Classification with Reasoning
```bashuv run classify-dataset.py \# SmolLM3's thinking mode for nuanced feedback analysishf jobs uv run \ --flavor l4x1 \ --image vllm/vllm-openai:latest \ https://huggingface.co/datasets/uv-scripts/classification/raw/main/classify-dataset.py \ --input-dataset user/customer-feedback \ --column text \ --labels "very_positive,positive,neutral,negative,very_negative" \21 unmodified lines --shuffle
# With reasoning for nuanced classificationuv run classify-dataset.py \hf jobs uv run \ --flavor l4x1 \ --image vllm/vllm-openai:latest \ https://huggingface.co/datasets/uv-scripts/classification/raw/main/classify-dataset.py \ --input-dataset librarian-bots/arxiv-metadata-snapshot \ --column abstract \ --labels "multimodal,agents,reasoning,safety,efficiency" \22 unmodified lines```
### GPU Flavors- `t4-small`: Budget option for smaller models- `l4x1`: Good balance for 7B models- `a10g-small`: Fast inference for 3B models- `a10g-large`: More memory for larger models- `a100-large`: Maximum performance- `l4x1`: **Recommended starting point** - great for SmolLM3- `a10g-large`: More memory for larger batches or 7B+ models- `a100-large`: Maximum performance for demanding workloads
## 🔧 Advanced Usage
20 unmodified lines
### Using Different Models
By default, this script uses **HuggingFaceTB/SmolLM3-3B** - a fast, efficient 3B parameter model that's perfect for most classification tasks. You can easily use any other instruction-tuned model:By default, this script uses **[HuggingFaceTB/SmolLM3-3B](https://huggingface.co/HuggingFaceTB/SmolLM3-3B)** - a state-of-the-art 3B parameter model specifically designed for efficient inference. SmolLM3 features:- Native thinking capabilities with `<think>` tags for step-by-step reasoning- Excellent performance on classification tasks- Fast inference speed (50-100 texts/second on A10)- Low memory footprint allowing larger batch sizes
While you can use other models, SmolLM3 is recommended for its balance of quality, speed, and reasoning capabilities:
```bash# Larger model for complex classificationREADME.md+33-15