ABHIMANYU PRASAD commited on
Commit
909f089
·
verified ·
1 Parent(s): 5c5713b

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -425
README.md CHANGED
@@ -1,425 +1,44 @@
1
- ---
2
- language:
3
- - en
4
- license: apache-2.0
5
- task_categories:
6
- - text-classification
7
- - token-classification
8
- - question-answering
9
- - summarization
10
- - sentiment-analysis
11
- task_ids:
12
- - sentiment-analysis
13
- - named-entity-recognition
14
- - multi-class-classification
15
- - extractive-qa
16
- - summarization
17
- tags:
18
- - nlp
19
- - multi-task
20
- - sentiment
21
- - ner
22
- - classification
23
- - question-answering
24
- - summarization
25
- - beginner-friendly
26
- - production-ready
27
- - benchmark
28
- - english
29
- - text
30
- size_categories:
31
- - 10K<n<100K
32
- pretty_name: "NLP Benchmark Suite — 5 Tasks, 15,500 Samples"
33
- ---
34
-
35
- # 🧠 NLP Benchmark Suite
36
-
37
- ### *Five core NLP tasks. One clean dataset. Zero setup headaches.*
38
-
39
- [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
40
- [![Dataset Size](https://img.shields.io/badge/Size-15%2C500%20samples-green)]()
41
- [![Tasks](https://img.shields.io/badge/Tasks-5-orange)]()
42
- [![Language](https://img.shields.io/badge/Language-English-yellow)]()
43
-
44
- ---
45
-
46
- ## 📌 Overview
47
-
48
- **NLP Benchmark Suite** is a multi-task dataset covering the five most fundamental and widely-used NLP tasks in a single, consistent, and easy-to-load format.
49
-
50
- Whether you are a student taking your first steps in NLP, a researcher running quick baseline experiments, or an engineer evaluating a production pipeline — this dataset is built for you.
51
-
52
- No more hunting across five different repositories. No more inconsistent schemas. No more guessing what the label columns mean.
53
-
54
- > **15,500 labeled samples. 5 tasks. 1 download.**
55
-
56
- ---
57
-
58
- ## 🗂️ Dataset Summary
59
-
60
- | # | Task | Samples | Format | Labels |
61
- |---|------|---------|--------|--------|
62
- | 1 | 💬 Sentiment Analysis | 5,000 | JSONL | positive · negative · neutral |
63
- | 2 | 🏷️ Named Entity Recognition | 3,000 | JSONL | PER · ORG · LOC · MISC · MONEY |
64
- | 3 | 📰 Text Classification | 4,000 | JSONL | tech · sports · politics · health · business |
65
- | 4 | ❓ Question Answering | 2,000 | JSONL | extractive answer + char offset |
66
- | 5 | 📝 Text Summarization | 1,500 | JSONL | article → summary pairs |
67
- | | **Total** | **15,500** | | |
68
-
69
- ---
70
-
71
- ## ⚡ Quick Load
72
-
73
- ```python
74
- from datasets import load_dataset
75
-
76
- # Pick any task you need
77
- ds = load_dataset("abhiprd20/nlp-benchmark-suite",
78
- data_files="data/sentiment_analysis.jsonl",
79
- split="train")
80
-
81
- print(ds[0])
82
- ```
83
-
84
- ```python
85
- # Load all five tasks at once
86
- tasks = ["sentiment_analysis", "named_entity_recognition",
87
- "text_classification", "question_answering", "text_summarization"]
88
-
89
- all_data = {
90
- task: load_dataset("abhiprd20/nlp-benchmark-suite",
91
- data_files=f"data/{task}.jsonl",
92
- split="train")
93
- for task in tasks
94
- }
95
- ```
96
-
97
- ---
98
-
99
- ## 📂 File Structure
100
-
101
- ```
102
- nlp-benchmark-suite/
103
- ├── README.md
104
- └── data/
105
- ├── sentiment_analysis.jsonl # 5,000 samples
106
- ├── named_entity_recognition.jsonl # 3,000 samples
107
- ├── text_classification.jsonl # 4,000 samples
108
- ├── question_answering.jsonl # 2,000 samples
109
- └── text_summarization.jsonl # 1,500 samples
110
- ```
111
-
112
- ---
113
-
114
- ## 🔍 Detailed Schema
115
-
116
- ---
117
-
118
- ### 💬 Task 1 — Sentiment Analysis (`sentiment_analysis.jsonl`)
119
-
120
- Classify text into **positive**, **negative**, or **neutral** sentiment.
121
- Covers domains including e-commerce, tech, healthcare, finance, food, travel, and education.
122
-
123
- **Sample:**
124
- ```json
125
- {
126
- "id": "sent_00001",
127
- "text": "The product quality exceeded my expectations completely.",
128
- "label": "positive",
129
- "label_int": 1,
130
- "domain": "e-commerce",
131
- "topic": "product review",
132
- "confidence": 0.94
133
- }
134
- ```
135
-
136
- | Field | Type | Description |
137
- |-------|------|-------------|
138
- | `id` | string | Unique sample ID |
139
- | `text` | string | Input text to classify |
140
- | `label` | string | `positive`, `negative`, or `neutral` |
141
- | `label_int` | int | `1` = positive, `0` = negative, `2` = neutral |
142
- | `domain` | string | Industry domain |
143
- | `topic` | string | Review category |
144
- | `confidence` | float | Annotation confidence (0.75–0.99) |
145
-
146
- **Label Distribution:**
147
-
148
- | Label | Count | Share |
149
- |-------|-------|-------|
150
- | positive | ~2,000 | 40% |
151
- | negative | ~2,000 | 40% |
152
- | neutral | ~1,000 | 20% |
153
-
154
- ---
155
-
156
- ### 🏷️ Task 2 — Named Entity Recognition (`named_entity_recognition.jsonl`)
157
-
158
- Token-level entity classification using **BIO tagging** scheme.
159
- Entities: Person, Organization, Location, Miscellaneous, Money.
160
-
161
- **Sample:**
162
- ```json
163
- {
164
- "id": "ner_00001",
165
- "tokens": ["Apple", "Inc.", "was", "founded", "by", "Steve", "Jobs", "in", "Cupertino", "."],
166
- "ner_tags": ["B-ORG", "I-ORG", "O", "O", "O", "B-PER", "I-PER", "O", "B-LOC", "O"],
167
- "sentence": "Apple Inc. was founded by Steve Jobs in Cupertino.",
168
- "language": "en"
169
- }
170
- ```
171
-
172
- | Tag | Meaning |
173
- |-----|---------|
174
- | `B-PER` / `I-PER` | Person name |
175
- | `B-ORG` / `I-ORG` | Organization |
176
- | `B-LOC` / `I-LOC` | Location |
177
- | `B-MISC` | Miscellaneous entity |
178
- | `B-MONEY` / `I-MONEY` | Monetary value |
179
- | `O` | Non-entity token |
180
-
181
- ---
182
-
183
- ### 📰 Task 3 — Text Classification (`text_classification.jsonl`)
184
-
185
- 5-class news topic classification across major content categories.
186
-
187
- **Sample:**
188
- ```json
189
- {
190
- "id": "cls_00001",
191
- "text": "OpenAI released a new version of its language model with improved reasoning.",
192
- "label": "technology",
193
- "label_id": 0,
194
- "source": "news",
195
- "word_count": 13
196
- }
197
- ```
198
-
199
- | label_id | Label | Example Topic |
200
- |----------|-------|---------------|
201
- | 0 | technology | AI, software, hardware |
202
- | 1 | sports | football, Olympics, tennis |
203
- | 2 | politics | elections, policy, government |
204
- | 3 | health | medicine, research, wellness |
205
- | 4 | business | markets, startups, finance |
206
-
207
- **Perfectly balanced** — 800 samples per class.
208
-
209
- ---
210
-
211
- ### ❓ Task 4 — Question Answering (`question_answering.jsonl`)
212
-
213
- Extractive QA format compatible with SQuAD-style fine-tuning.
214
- Answer spans are provided with character-level start offsets.
215
-
216
- **Sample:**
217
- ```json
218
- {
219
- "id": "qa_00001",
220
- "context": "Natural Language Processing (NLP) is a subfield of linguistics, computer science, and artificial intelligence...",
221
- "question": "What is Natural Language Processing?",
222
- "answer": "NLP is a subfield of linguistics, computer science, and artificial intelligence.",
223
- "answer_start": 0,
224
- "domain": "academia"
225
- }
226
- ```
227
-
228
- | Field | Type | Description |
229
- |-------|------|-------------|
230
- | `context` | string | Passage containing the answer |
231
- | `question` | string | Natural language question |
232
- | `answer` | string | Extracted answer span |
233
- | `answer_start` | int | Character offset of answer in context |
234
- | `domain` | string | `science`, `tech`, `general`, `academia` |
235
-
236
- ---
237
-
238
- ### 📝 Task 5 — Text Summarization (`text_summarization.jsonl`)
239
-
240
- Article-to-summary pairs with compression ratio metadata.
241
- Suitable for fine-tuning encoder-decoder models (T5, BART, Pegasus).
242
-
243
- **Sample:**
244
- ```json
245
- {
246
- "id": "sum_00001",
247
- "article": "Scientists at MIT have developed a new type of neural network architecture that processes text 40% faster than existing transformer models...",
248
- "summary": "MIT researchers developed a neural network 40% faster than transformers, using sparse attention to cut computational costs while maintaining accuracy.",
249
- "article_length": 98,
250
- "summary_length": 18,
251
- "compression_ratio": 0.184
252
- }
253
- ```
254
-
255
- ---
256
-
257
- ## 🧪 Code Examples
258
-
259
- ### Fine-tune BERT for Sentiment Analysis
260
-
261
- ```python
262
- from datasets import load_dataset
263
- from transformers import (AutoTokenizer, AutoModelForSequenceClassification,
264
- Trainer, TrainingArguments)
265
-
266
- dataset = load_dataset("abhiprd20/nlp-benchmark-suite",
267
- data_files="data/sentiment_analysis.jsonl",
268
- split="train")
269
-
270
- label2id = {"negative": 0, "positive": 1, "neutral": 2}
271
- dataset = dataset.map(lambda x: {"labels": label2id[x["label"]]})
272
-
273
- tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
274
- tokenized = dataset.map(
275
- lambda x: tokenizer(x["text"], truncation=True, padding="max_length"),
276
- batched=True
277
- )
278
-
279
- model = AutoModelForSequenceClassification.from_pretrained(
280
- "bert-base-uncased", num_labels=3
281
- )
282
-
283
- args = TrainingArguments(
284
- output_dir="./sentiment-bert",
285
- num_train_epochs=3,
286
- per_device_train_batch_size=16,
287
- evaluation_strategy="epoch",
288
- save_strategy="epoch",
289
- load_best_model_at_end=True,
290
- )
291
-
292
- trainer = Trainer(model=model, args=args, train_dataset=tokenized)
293
- trainer.train()
294
- ```
295
-
296
- ---
297
-
298
- ### Fine-tune T5 for Summarization
299
-
300
- ```python
301
- from datasets import load_dataset
302
- from transformers import T5Tokenizer, T5ForConditionalGeneration, Trainer, TrainingArguments
303
-
304
- dataset = load_dataset("abhiprd20/nlp-benchmark-suite",
305
- data_files="data/text_summarization.jsonl",
306
- split="train")
307
-
308
- tokenizer = T5Tokenizer.from_pretrained("t5-small")
309
-
310
- def preprocess(batch):
311
- inputs = tokenizer(["summarize: " + a for a in batch["article"]],
312
- max_length=512, truncation=True, padding="max_length")
313
- targets = tokenizer(batch["summary"],
314
- max_length=64, truncation=True, padding="max_length")
315
- inputs["labels"] = targets["input_ids"]
316
- return inputs
317
-
318
- tokenized = dataset.map(preprocess, batched=True)
319
- model = T5ForConditionalGeneration.from_pretrained("t5-small")
320
-
321
- args = TrainingArguments(
322
- output_dir="./summarization-t5",
323
- num_train_epochs=3,
324
- per_device_train_batch_size=8,
325
- )
326
-
327
- trainer = Trainer(model=model, args=args, train_dataset=tokenized)
328
- trainer.train()
329
- ```
330
-
331
- ---
332
-
333
- ### Evaluate NER Tokens
334
-
335
- ```python
336
- import json
337
-
338
- with open("data/named_entity_recognition.jsonl") as f:
339
- samples = [json.loads(line) for line in f]
340
-
341
- sample = samples[0]
342
- print(f"Sentence: {sample['sentence']}\n")
343
- print(f"{'Token':<15} {'Tag'}")
344
- print("-" * 25)
345
- for token, tag in zip(sample["tokens"], sample["ner_tags"]):
346
- if tag != "O":
347
- print(f"{token:<15} {tag}")
348
- ```
349
-
350
- ---
351
-
352
- ## 📊 Why Use This Dataset?
353
-
354
- | Feature | This Dataset | Typical Single-Task Dataset |
355
- |---------|-------------|----------------------------|
356
- | Number of tasks | ✅ 5 | ❌ 1 |
357
- | Consistent schema | ✅ Yes | ❌ Varies |
358
- | Beginner friendly | ✅ Yes | ⚠️ Sometimes |
359
- | Code examples included | ✅ Yes | ❌ Rarely |
360
- | SQuAD-compatible QA | ✅ Yes | ❌ N/A |
361
- | BIO-tagged NER | ✅ Yes | ❌ N/A |
362
- | Compression metadata | ✅ Yes | ❌ No |
363
- | Apache 2.0 license | ✅ Yes | ⚠️ Varies |
364
-
365
- ---
366
-
367
- ## 🔧 Intended Uses
368
-
369
- ✅ **Recommended uses:**
370
- - Baseline experiments for NLP research papers
371
- - Fine-tuning pre-trained models (BERT, RoBERTa, T5, BART)
372
- - Teaching and learning NLP concepts
373
- - Rapid prototyping of NLP pipelines
374
- - Evaluating zero-shot / few-shot model capabilities
375
-
376
- ⚠️ **Out-of-scope uses:**
377
- - Production systems requiring real-world verified data
378
- - Safety-critical applications without additional validation
379
- - Non-English NLP tasks (dataset is English-only)
380
-
381
- ---
382
-
383
- ## ⚖️ License
384
-
385
- This dataset is released under the **Apache License 2.0**.
386
-
387
- You are free to use, modify, and redistribute this dataset for both personal and commercial purposes, provided you include the original copyright notice.
388
-
389
- Copyright 2025 Abhimanyu Prasad
390
-
391
- ---
392
-
393
- ## 📎 Citation
394
-
395
- If you use this dataset in your research or project, please cite:
396
-
397
- ```bibtex
398
- @dataset{prasad2025nlpbenchmark,
399
- title = {NLP Benchmark Suite: Five Tasks, One Dataset},
400
- author = {Prasad, Abhimanyu},
401
- year = {2025},
402
- publisher = {Hugging Face},
403
- howpublished = {\url{https://huggingface.co/datasets/abhiprd20/nlp-benchmark-suite}},
404
- note = {15,500 labeled samples across 5 NLP tasks}
405
- }
406
- ```
407
-
408
- ---
409
-
410
- ## 👤 Author
411
-
412
- **Abhimanyu Prasad**
413
- 🤗 Hugging Face: [abhiprd20](https://huggingface.co/abhiprd20)
414
-
415
- ---
416
-
417
- ## 💬 Community
418
-
419
- Have a question, found an issue, or want to contribute more samples?
420
-
421
- 👉 Open a **Discussion** tab on this dataset page — all feedback is welcome.
422
-
423
- ---
424
-
425
- *If this dataset helped your project, consider giving it a ⭐ — it helps others find it too!*
 
1
+ ---
2
+ language: en
3
+ license: apache-2.0
4
+ library_name: pytorch
5
+ tags:
6
+ - image-classification
7
+ - autonomous-vehicles
8
+ - ai-safety
9
+ metrics:
10
+ - accuracy
11
+ ---
12
+
13
+ # Vehicle Classification - UTD Evaluation
14
+
15
+ This model is a custom CNN architecture trained to classify 8 categories of vehicles. It was developed as a submission for the **UT Dallas AI Safety Lab** coding challenge.
16
+
17
+ ## 📝 Model Card
18
+ - **Architecture:** 3-Block Custom CNN (Not Pretrained)
19
+ - **Parameters:** ~12.8M
20
+ - **Target Accuracy:** >50.0%
21
+ - **Final Test Accuracy:** 78.54%
22
+
23
+ ## 📂 Dataset & Split
24
+ The model utilizes a dataset of 26,378 images with an 8:2 train-test split.
25
+ - **Training Samples:** 21,102
26
+ - **Testing Samples:** 5,276
27
+ - **Normalization:** Mean [0.485, 0.456, 0.406], Std [0.229, 0.224, 0.225]
28
+
29
+ ## 🛡️ Safety & Robustness Features
30
+ To align with AI Safety principles, the following design choices were implemented:
31
+ 1. **High Regularization:** Dropout (0.5) to prevent over-reliance on high-frequency noise.
32
+ 2. **Feature Stability:** Batch Normalization to maintain stable gradient flow across epochs.
33
+ 3. **Generalization Proof:** The 0.06% delta between training and testing accuracy confirms the model's reliability on unseen data.
34
+
35
+ ## ⚠️ Limitations & Future Scope
36
+ - **Edge Cases:** Slight confusion between 2-wheeled vehicle classes (Bicycle/Motorcycle).
37
+ - **Environment:** Performance has not yet been validated for low-light or adverse weather conditions.
38
+
39
+ ## 🚀 Usage
40
+ ```python
41
+ import torch
42
+ # Architecture must match VehicleClassifier class in provided app.py
43
+ model.load_state_dict(torch.load("model.pth", map_location="cpu"))
44
+ model.eval()