x2-world commited on
Commit
fb1ee97
·
verified ·
1 Parent(s): 2b6c75e

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +49 -0
README.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Text classification demo (Hugging Face)
2
+
3
+ This repo contains a minimal example to fine-tune a Hugging Face model for text classification.
4
+
5
+ Quick start (PowerShell):
6
+
7
+ 1. Activate your venv:
8
+
9
+ ```powershell
10
+ & "C:\Users\Humberto Arias\recipe_bot\venv\Scripts\Activate.ps1"
11
+ ```
12
+
13
+ 2. Install dependencies:
14
+
15
+ ```powershell
16
+ pip install --upgrade pip
17
+ pip install transformers datasets accelerate evaluate huggingface-hub
18
+ ```
19
+
20
+ 3. Smoke test:
21
+
22
+ ```powershell
23
+ python text_classification_demo.py --smoke-test
24
+ ```
25
+
26
+ 4. Prepare `data/train.csv` with `text,label` columns and run training:
27
+
28
+ ```powershell
29
+ python text_classification_demo.py --train_file data/train.csv --model_name_or_path bert-base-uncased --output_dir ./outputs
30
+ ```
31
+
32
+ Notes:
33
+ - This example is intentionally minimal for learning. For larger runs, use `accelerate` and GPU instances.
34
+ - To push to the Hub, `huggingface-cli login` then `trainer.push_to_hub()` can be added.
35
+
36
+ Model on the Hub
37
+ -----------------
38
+ The demo model was pushed to: https://huggingface.co/x2-world/recipe-bert
39
+
40
+ Example inference (after pushing to Hub):
41
+ ```python
42
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
43
+
44
+ model_id = "x2-world/recipe-bert"
45
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
46
+ model = AutoModelForSequenceClassification.from_pretrained(model_id)
47
+ clf = pipeline('text-classification', model=model, tokenizer=tokenizer)
48
+ print(clf('The pizza was great'))
49
+ ```