Downloads · 30 days
9
33% of all-time downloads
x2-world/recipe-bert
recipe-bert is a machine learning model from x2-world. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repo contains a minimal example to fine-tune a Hugging Face model for text classification.
Downloads · 30 days
9
33% of all-time downloads
All-time downloads
27
Public
Parameters
124M
1.8 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors936 MB · 51%
From the Hugging Face model README
This repo contains a minimal example to fine-tune a Hugging Face model for text classification.
Quick start (PowerShell):
& "C:\Users\Humberto Arias\recipe_bot\venv\Scripts\Activate.ps1"
pip install --upgrade pip
pip install transformers datasets accelerate evaluate huggingface-hub
python text_classification_demo.py --smoke-test
data/train.csv with text,label columns and run training:python text_classification_demo.py --train_file data/train.csv --model_name_or_path bert-base-uncased --output_dir ./outputs
Notes:
accelerate and GPU instances.huggingface-cli login then trainer.push_to_hub() can be added.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'))