ByteMeHarder-404 commited on
Commit
413f666
·
verified ·
1 Parent(s): 845296b
Files changed (1) hide show
  1. README.md +39 -51
README.md CHANGED
@@ -1,65 +1,53 @@
1
  ---
2
- library_name: transformers
3
- license: apache-2.0
4
- base_model: bert-base-uncased
5
- tags:
6
- - generated_from_trainer
7
  metrics:
8
  - accuracy
9
- model-index:
10
- - name: train-test
11
- results: []
 
12
  ---
13
 
14
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
15
- should probably proofread and complete it, then remove this comment. -->
16
-
17
- # train-test
18
-
19
- This model is a fine-tuned version of [bert-base-uncased](https://huggingface.co/bert-base-uncased) on an unknown dataset.
20
- It achieves the following results on the evaluation set:
21
- - Loss: 0.2701
22
- - Accuracy: 0.9312
23
-
24
- ## Model description
25
-
26
- More information needed
27
-
28
- ## Intended uses & limitations
29
-
30
- More information needed
31
-
32
- ## Training and evaluation data
33
 
34
- More information needed
35
 
36
- ## Training procedure
 
 
 
 
 
 
37
 
38
- ### Training hyperparameters
 
 
 
 
 
39
 
40
- The following hyperparameters were used during training:
41
- - learning_rate: 3e-05
42
- - train_batch_size: 4
43
- - eval_batch_size: 8
44
- - seed: 42
45
- - gradient_accumulation_steps: 4
46
- - total_train_batch_size: 16
47
- - optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
48
- - lr_scheduler_type: linear
49
- - num_epochs: 2
50
- - mixed_precision_training: Native AMP
51
 
52
- ### Training results
 
 
 
53
 
54
- | Training Loss | Epoch | Step | Validation Loss | Accuracy |
55
- |:-------------:|:-----:|:----:|:---------------:|:--------:|
56
- | 0.1761 | 1.0 | 4210 | 0.2282 | 0.9300 |
57
- | 0.1127 | 2.0 | 8420 | 0.2701 | 0.9312 |
58
 
 
 
 
59
 
60
- ### Framework versions
 
 
61
 
62
- - Transformers 4.56.1
63
- - Pytorch 2.8.0+cu126
64
- - Datasets 4.0.0
65
- - Tokenizers 0.22.0
 
1
  ---
2
+ language: en
3
+ datasets:
4
+ - glue
 
 
5
  metrics:
6
  - accuracy
7
+ model-name: bert-base-uncased-finetuned-sst2
8
+ tags:
9
+ - text-classification
10
+ - sentiment-analysis
11
  ---
12
 
13
+ # BERT Base (uncased) fine-tuned on SST-2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
+ This model is a fine-tuned version of [bert-base-uncased](https://huggingface.co/bert-base-uncased) on the **GLUE SST-2** dataset for sentiment classification (positive vs. negative).
16
 
17
+ ## Model Details
18
+ - **Model type**: BERT (base, uncased)
19
+ - **Fine-tuned on**: SST-2 (Stanford Sentiment Treebank)
20
+ - **Labels**:
21
+ - 0 → Negative
22
+ - 1 → Positive
23
+ - **Training framework**: [🤗 Transformers](https://github.com/huggingface/transformers)
24
 
25
+ ## Training
26
+ - Epochs: 2
27
+ - Batch size: 4 (with gradient accumulation steps = 4)
28
+ - Learning rate: 3e-5
29
+ - Mixed precision: fp16
30
+ - Optimizer & Scheduler: Default Hugging Face Trainer
31
 
32
+ ## Evaluation Results
33
+ On the SST-2 validation set:
 
 
 
 
 
 
 
 
 
34
 
35
+ | Epoch | Training Loss | Validation Loss | Accuracy |
36
+ |-------|---------------|-----------------|----------|
37
+ | 1 | 0.1761 | 0.2282 | 93.0% |
38
+ | 2 | 0.1127 | 0.2701 | 93.1% |
39
 
40
+ Final averaged training loss: **0.1663**
 
 
 
41
 
42
+ ## How to Use
43
+ ```python
44
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
45
 
46
+ model_name = "your-username/bert-base-uncased-finetuned-sst2"
47
+ tok = AutoTokenizer.from_pretrained(model_name)
48
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
49
 
50
+ inputs = tok("I love Hugging Face!", return_tensors="pt")
51
+ outputs = model(**inputs)
52
+ pred = outputs.logits.argmax(dim=-1).item()
53
+ print("Label:", pred) # 1 = Positive