Update README.md
Browse files
README.md
CHANGED
|
@@ -1,199 +1,138 @@
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
-
tags:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
# Model Card for Model ID
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
## Model Details
|
| 13 |
|
| 14 |
### Model Description
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
| 19 |
|
| 20 |
-
- **Developed by:**
|
| 21 |
-
- **
|
| 22 |
-
- **
|
| 23 |
-
- **
|
| 24 |
-
- **
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
|
| 28 |
-
### Model Sources
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
- **Repository:** [More Information Needed]
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
|
| 36 |
## Uses
|
| 37 |
|
| 38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 39 |
-
|
| 40 |
### Direct Use
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
[More Information Needed]
|
| 45 |
-
|
| 46 |
-
### Downstream Use [optional]
|
| 47 |
-
|
| 48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 49 |
-
|
| 50 |
-
[More Information Needed]
|
| 51 |
|
| 52 |
### Out-of-Scope Use
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
[More Information Needed]
|
| 57 |
|
| 58 |
## Bias, Risks, and Limitations
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
[More Information Needed]
|
| 63 |
|
| 64 |
### Recommendations
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
|
| 70 |
## How to Get Started with the Model
|
| 71 |
|
| 72 |
-
|
| 73 |
|
| 74 |
-
|
|
|
|
| 75 |
|
| 76 |
-
|
| 77 |
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
-
|
| 81 |
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
### Training Procedure
|
| 85 |
-
|
| 86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 87 |
-
|
| 88 |
-
#### Preprocessing [optional]
|
| 89 |
-
|
| 90 |
-
[More Information Needed]
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
#### Training Hyperparameters
|
| 94 |
|
| 95 |
-
|
| 96 |
|
| 97 |
-
|
|
|
|
| 98 |
|
| 99 |
-
|
| 100 |
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
## Evaluation
|
| 104 |
|
| 105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
-
|
| 107 |
### Testing Data, Factors & Metrics
|
| 108 |
|
| 109 |
#### Testing Data
|
| 110 |
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
[More Information Needed]
|
| 114 |
-
|
| 115 |
-
#### Factors
|
| 116 |
-
|
| 117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
|
| 121 |
#### Metrics
|
| 122 |
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
|
| 127 |
### Results
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
#### Summary
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
## Model Examination [optional]
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
-
|
| 141 |
-
## Environmental Impact
|
| 142 |
-
|
| 143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
|
| 147 |
-
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
-
|
| 153 |
-
## Technical Specifications [optional]
|
| 154 |
|
| 155 |
### Model Architecture and Objective
|
| 156 |
|
| 157 |
-
|
| 158 |
|
| 159 |
### Compute Infrastructure
|
| 160 |
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
|
| 167 |
-
##
|
| 168 |
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
|
| 175 |
**BibTeX:**
|
| 176 |
|
| 177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
|
| 179 |
**APA:**
|
| 180 |
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## More Information [optional]
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
-
|
| 193 |
-
## Model Card Authors [optional]
|
| 194 |
-
|
| 195 |
-
[More Information Needed]
|
| 196 |
|
| 197 |
-
## Model Card
|
| 198 |
|
| 199 |
-
|
|
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
+
tags:
|
| 4 |
+
- text-style-transfer
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
datasets:
|
| 7 |
+
- GuillermoTBB/charles-dickens-text-classification
|
| 8 |
+
language:
|
| 9 |
+
- en
|
| 10 |
+
metrics:
|
| 11 |
+
- accuracy
|
| 12 |
+
base_model: distilbert/distilbert-base-uncased
|
| 13 |
+
pipeline_tag: text-classification
|
| 14 |
---
|
| 15 |
|
| 16 |
# Model Card for Model ID
|
| 17 |
|
| 18 |
+
**Charles Dickens Text Classifier**
|
|
|
|
| 19 |
|
| 20 |
+
This model is a text classification model fine-tuned on a dataset designed to distinguish between paragraphs written by Charles Dickens and those that imitate his style. The model uses `distilbert-base-uncased` as the base model and has been fine-tuned on 1,100 samples with 100 positive and 1,000 negative examples, achieving an accuracy of 99.5%.
|
| 21 |
|
| 22 |
## Model Details
|
| 23 |
|
| 24 |
### Model Description
|
| 25 |
|
| 26 |
+
This is a text classification model developed to classify text as either written by Charles Dickens or generated in different styles. It is built using the `distilbert-base-uncased` model from the Hugging Face Transformers library and fine-tuned on a dataset specifically designed for this task.
|
|
|
|
|
|
|
| 27 |
|
| 28 |
+
- **Developed by:** Independent ML Engineer
|
| 29 |
+
- **Model type:** Text Classification
|
| 30 |
+
- **Language(s) (NLP):** English (en)
|
| 31 |
+
- **License:** Apache-2.0
|
| 32 |
+
- **Finetuned from model:** `distilbert/distilbert-base-uncased`
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
### Model Sources
|
| 35 |
|
| 36 |
+
- **Generation Script**: [this colab](https://colab.research.google.com/drive/1Cvx_UpaBWJFQZvLsRk5LdPPRugNVo8gn)
|
| 37 |
+
- **Example usage**: [this colab to validate methods of text-style-transfer](https://colab.research.google.com/drive/1haZ8xlraV76a3Ld3tpVtIwxMP8nemkKl)
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
## Uses
|
| 40 |
|
|
|
|
|
|
|
| 41 |
### Direct Use
|
| 42 |
|
| 43 |
+
This model can be directly used for distinguishing between authentic Charles Dickens texts and texts generated in various imitative styles. It can be used for literary analysis, text style transfer evaluation, and educational purposes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
### Out-of-Scope Use
|
| 46 |
|
| 47 |
+
This model is not suitable for general text classification tasks outside of the scope of identifying Charles Dickens' writing style. Misuse of the model might include applying it to texts outside of the intended use case or in a context where the stylistic nuances of Dickens' writing are not relevant.
|
|
|
|
|
|
|
| 48 |
|
| 49 |
## Bias, Risks, and Limitations
|
| 50 |
|
| 51 |
+
The model may have biases related to the synthetic nature of the negative examples, which might not fully capture the diversity of non-Dickensian writing styles. The dataset is based only on "Great Expectations" and might not generalize well to other works by Dickens or other authors.
|
|
|
|
|
|
|
| 52 |
|
| 53 |
### Recommendations
|
| 54 |
|
| 55 |
+
Users should be aware of the synthetic nature of the negative samples, which might limit the model's generalizability. It is recommended to expand the dataset to include more works by Dickens for a more robust classification.
|
|
|
|
|
|
|
| 56 |
|
| 57 |
## How to Get Started with the Model
|
| 58 |
|
| 59 |
+
To use this model, load it using the Hugging Face Transformers library:
|
| 60 |
|
| 61 |
+
```python
|
| 62 |
+
from transformers import pipeline
|
| 63 |
|
| 64 |
+
classifier = pipeline("text-classification", model="GuillermoTBB/charles-dickens-classifier", tokenizer="GuillermoTBB/charles-dickens-classifier")
|
| 65 |
|
| 66 |
+
text = "Your text here..."
|
| 67 |
+
result = classifier(text)
|
| 68 |
+
print(result)
|
| 69 |
+
```
|
| 70 |
|
| 71 |
+
An example to use this model can be found in [this colab](https://colab.research.google.com/drive/1haZ8xlraV76a3Ld3tpVtIwxMP8nemkKl) used to validate different methods to transfer text style.
|
| 72 |
|
| 73 |
+
## Training Details
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
+
### Training Data
|
| 76 |
|
| 77 |
+
The model was trained on a dataset composed of 1,100 paragraphs, where 100 were original excerpts from "Great Expectations" by Charles Dickens and 1,000 were synthetic examples generated by rewriting the Dickensian paragraphs in 10 distinct styles using GPT-4.
|
| 78 |
+
Dataset can be found [HF GuillermoTBB/charles-dickens-text-classification](https://huggingface.co/datasets/GuillermoTBB/charles-dickens-text-classification)
|
| 79 |
|
| 80 |
+
### Training Procedure
|
| 81 |
|
| 82 |
+
The model was fine-tuned using the following hyperparameters:
|
| 83 |
+
- **Training regime:** Mixed precision (fp16) on a single T4 GPU
|
| 84 |
+
- **Learning rate:** 2e-5
|
| 85 |
+
- **Batch size:** 16
|
| 86 |
+
- **Epochs:** 2
|
| 87 |
+
- **Optimizer:** AdamW
|
| 88 |
+
- **Weight decay:** 0.01
|
| 89 |
|
| 90 |
## Evaluation
|
| 91 |
|
|
|
|
|
|
|
| 92 |
### Testing Data, Factors & Metrics
|
| 93 |
|
| 94 |
#### Testing Data
|
| 95 |
|
| 96 |
+
The test set consisted of 220 samples, stratified to maintain a balanced class distribution.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
#### Metrics
|
| 99 |
|
| 100 |
+
The primary evaluation metric was accuracy, which is ideal for binary classification tasks. The model achieved a test accuracy of 99.5%.
|
|
|
|
|
|
|
| 101 |
|
| 102 |
### Results
|
| 103 |
|
| 104 |
+
The model performed exceptionally well on the test set with an accuracy of 99.5%, demonstrating its effectiveness in distinguishing between Dickensian and non-Dickensian text.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
|
|
|
| 106 |
|
| 107 |
+
## Technical Specifications
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
### Model Architecture and Objective
|
| 110 |
|
| 111 |
+
The model is based on the `distilbert-base-uncased` architecture, fine-tuned to perform binary text classification.
|
| 112 |
|
| 113 |
### Compute Infrastructure
|
| 114 |
|
| 115 |
+
- **Hardware:** Google Colab with a T4 GPU
|
| 116 |
+
- **Software:** Python 3.7, PyTorch 1.7, Hugging Face Transformers 4.5
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
+
## Citation
|
| 119 |
|
| 120 |
+
Please cite the following if you use this model:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
**BibTeX:**
|
| 123 |
|
| 124 |
+
```bibtex
|
| 125 |
+
@misc{guillermo2024charlesdickens,
|
| 126 |
+
title={Charles Dickens Text Classifier},
|
| 127 |
+
author={Guillermo Blasco},
|
| 128 |
+
year={2024},
|
| 129 |
+
howpublished={\url{https://huggingface.co/GuillermoTBB/charles-dickens-classifier}},
|
| 130 |
+
}
|
| 131 |
|
| 132 |
**APA:**
|
| 133 |
|
| 134 |
+
Blasco, G. (2024). Charles Dickens Text Classifier. Retrieved from https://huggingface.co/GuillermoTBB/charles-dickens-classifier.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
+
## Model Card Authors
|
| 137 |
|
| 138 |
+
- Guillermo Blasco, Independent ML Engineer
|