JCCHH commited on
Commit
870e323
·
verified ·
1 Parent(s): d3fc2b2

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. README.md +46 -0
  2. config.json +31 -0
  3. model.safetensors +3 -0
  4. tokenizer.json +0 -0
  5. tokenizer_config.json +14 -0
README.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: apache-2.0
4
+ base_model: bert-base-uncased
5
+ tags:
6
+ - sentiment-analysis
7
+ - imdb
8
+ - text-classification
9
+ widget:
10
+ - text: "This movie was absolutely fantastic! Best film I've seen all year."
11
+ ---
12
+
13
+ # BERT Fine-tuned on IMDB for Sentiment Analysis
14
+
15
+ Fine-tuned from `bert-base-uncased` on the Stanford IMDB dataset for binary sentiment classification.
16
+
17
+ ## Training Details
18
+
19
+ | Parameter | Value |
20
+ |-----------|-------|
21
+ | Base model | bert-base-uncased |
22
+ | Learning rate | 2e-5 |
23
+ | Batch size | 4 |
24
+ | Epochs | 2 |
25
+ | Max sequence length | 512 |
26
+
27
+ ## Usage
28
+
29
+ ```python
30
+ from transformers import BertForSequenceClassification, BertTokenizer
31
+
32
+ tokenizer = BertTokenizer.from_pretrained("COMP6713bert/imdb-bert-sentiment")
33
+ model = BertForSequenceClassification.from_pretrained("COMP6713bert/imdb-bert-sentiment")
34
+
35
+ inputs = tokenizer("This movie was great!", return_tensors="pt", truncation=True, max_length=512)
36
+ with torch.no_grad():
37
+ outputs = model(**inputs)
38
+ predicted = torch.argmax(outputs.logits, dim=-1).item()
39
+
40
+ print("Positive" if predicted == 1 else "Negative")
41
+ ```
42
+
43
+ ## Labels
44
+
45
+ - 0: Negative
46
+ - 1: Positive
config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_cross_attention": false,
3
+ "architectures": [
4
+ "BertForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": null,
8
+ "classifier_dropout": null,
9
+ "dtype": "float32",
10
+ "eos_token_id": null,
11
+ "gradient_checkpointing": false,
12
+ "hidden_act": "gelu",
13
+ "hidden_dropout_prob": 0.1,
14
+ "hidden_size": 768,
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 3072,
17
+ "is_decoder": false,
18
+ "layer_norm_eps": 1e-12,
19
+ "max_position_embeddings": 512,
20
+ "model_type": "bert",
21
+ "num_attention_heads": 12,
22
+ "num_hidden_layers": 12,
23
+ "pad_token_id": 0,
24
+ "position_embedding_type": "absolute",
25
+ "problem_type": "single_label_classification",
26
+ "tie_word_embeddings": true,
27
+ "transformers_version": "5.5.3",
28
+ "type_vocab_size": 2,
29
+ "use_cache": false,
30
+ "vocab_size": 30522
31
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c34ee7fe8c6d359f23d9d17fe9cda0de8e2a7829f926bba4cc92613d0d73378a
3
+ size 437958624
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "cls_token": "[CLS]",
4
+ "do_lower_case": true,
5
+ "is_local": false,
6
+ "mask_token": "[MASK]",
7
+ "model_max_length": 512,
8
+ "pad_token": "[PAD]",
9
+ "sep_token": "[SEP]",
10
+ "strip_accents": null,
11
+ "tokenize_chinese_chars": true,
12
+ "tokenizer_class": "BertTokenizer",
13
+ "unk_token": "[UNK]"
14
+ }