YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co/docs/hub/model-cards#model-card-metadata)
Text classification demo (Hugging Face)
This repo contains a minimal example to fine-tune a Hugging Face model for text classification.
Quick start (PowerShell):
- Activate your venv:
& "C:\Users\Humberto Arias\recipe_bot\venv\Scripts\Activate.ps1"
- Install dependencies:
pip install --upgrade pip
pip install transformers datasets accelerate evaluate huggingface-hub
- Smoke test:
python text_classification_demo.py --smoke-test
- Prepare
data/train.csvwithtext,labelcolumns and run training:
python text_classification_demo.py --train_file data/train.csv --model_name_or_path bert-base-uncased --output_dir ./outputs
Notes:
- This example is intentionally minimal for learning. For larger runs, use
accelerateand GPU instances. - To push to the Hub,
huggingface-cli loginthentrainer.push_to_hub()can be added.
Model on the Hub
The demo model was pushed to: https://huggingface.co/x2-world/recipe-bert
Example inference (after pushing to Hub):
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
model_id = "x2-world/recipe-bert"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
clf = pipeline('text-classification', model=model, tokenizer=tokenizer)
print(clf('The pizza was great'))
- Downloads last month
- 3
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
๐
Ask for provider support