Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
Falko Victor Habel | 752013d4d6 | |
Falko Victor Habel | c49b57a951 | |
Falko Victor Habel | 71fdd5ee86 |
|
@ -150,6 +150,10 @@ dmypy.json
|
||||||
# pytype static type analyzer
|
# pytype static type analyzer
|
||||||
.pytype/
|
.pytype/
|
||||||
|
|
||||||
|
# Model
|
||||||
|
VeraMind-Mini
|
||||||
|
VeraMind-Edge
|
||||||
|
|
||||||
# Cython debug symbols
|
# Cython debug symbols
|
||||||
cython_debug/
|
cython_debug/
|
||||||
|
|
||||||
|
|
65
README.md
65
README.md
|
@ -1,44 +1,38 @@
|
||||||
# VeraMind
|
# VeraMind
|
||||||
|
|
||||||
|
**VeraMind** is a fine-tuned machine learning model designed to predict whether a news article is real or fake. Built using the Hugging Face Transformers library and PyTorch, the `VeraMind` model suite is optimized for binary text classification tasks.
|
||||||
|
|
||||||
The VeraMind is an open-source Python application built using the Hugging Face Transformers library and PyTorch. It leverages a pre-trained model (`VeraMind-Mini`) to predict whether a given news article is real or fake with a confidence score.
|
|
||||||
|
|
||||||
This project is licensed under the [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)](https://creativecommons.org/licenses/by-nc-nd/4.0/) license. You are free to use and share this model privately, but you must give appropriate credit, not use it for commercial purposes, and not distribute derivative works.
|
|
||||||
|
|
||||||
**Note:** This is a machine learning model and may make mistakes. It should not replace your own critical thinking when evaluating news authenticity. Always verify information from multiple reliable sources.
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Predicts if a given news article is real or fake.
|
- **Real or Fake Prediction**: Classifies news articles as "REAL" or "FAKE."
|
||||||
- Provides a confidence score for the prediction.
|
- **Confidence Score**: Provides a numerical confidence score for each prediction.
|
||||||
- Utilizes the Hugging Face Transformers library for easy integration with other NLP models.
|
- **Fine-Tuned Model**: Uses `VeraMind-Edge`, a fine-tuned version of [fabelous-albert-uncased](https://gitea.fabelous.app/Fabel/Fabelous-albert-uncased), for robust and reliable predictions. `VeraMind-Mini` is based on [DistilBERT](https://huggingface.co/distilbert/distilbert-base-multilingual-cased) and optimized for server-side usage.
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
1. Clone this repository:
|
## Model Variants
|
||||||
|
|
||||||
```bash
|
- **VeraMind-Mini**: Optimized for server-side usage, offering robust performance and efficiency for large-scale operations. Based on DistilBERT architecture.
|
||||||
git clone https://github.com/yourusername/VeraMind.git
|
- **VeraMind-Edge**: Designed for client-side usage, offering a lightweight and resource-efficient solution for local inference. Based on fabelous-albert-uncased architecture.
|
||||||
cd VeraMind
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Install the required dependencies:
|
|
||||||
|
|
||||||
```bash
|
## Downloading the Model
|
||||||
pip install -r requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
You can download the `VeraMind` models from the following links:
|
||||||
|
|
||||||
### Predicting News Authenticity
|
- [Download VeraMind-Mini (Server-Side)](https://gitea.fabelous.app/Fabel/VeraMind/releases/download/0.1/VeraMind-Mini.zip)
|
||||||
|
- [Download VeraMind-Edge (Client-Side)](https://gitea.fabelous.app/Fabel/VeraMind/releases/download/0.1.1/VeraMind-Edge.zip)
|
||||||
|
|
||||||
Here's how you can use the model to predict if a news article is real or fake:
|
|
||||||
|
## Usage Example
|
||||||
|
|
||||||
|
The example below demonstrates how to use the `VeraMindInference` class to evaluate the authenticity of a news article:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from src.Inference import VeraMindInference
|
from src.Inference import VeraMindInference
|
||||||
|
|
||||||
# Load the model
|
# Load the model
|
||||||
model = VeraMindInference("path/to/VeraMind-Mini")
|
model = VeraMindInference("VeraMind-Edge") # Use VeraMind-Mini for server-side usage
|
||||||
|
|
||||||
# Example news article text
|
# Example news article text
|
||||||
text = "This is an example News Article"
|
text = "This is an example News Article"
|
||||||
|
@ -49,24 +43,35 @@ result = model.predict(text)
|
||||||
print(result)
|
print(result)
|
||||||
```
|
```
|
||||||
|
|
||||||
The output will be a dictionary containing the result ("REAL" or "FAKE") and the confidence score:
|
Output:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
{'result': 'FAKE', 'confidence': 0.9990140199661255}
|
{'result': 'FAKE', 'confidence': 0.9990140199661255}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Model Architecture
|
|
||||||
|
|
||||||
The `VeraMind-Mini` model used in this application is a fine-tuned version of the [DistilBERT](https://huggingface.co/distilbert-base-uncased) model for binary text classification. It's designed to distinguish between real and fake news articles.
|
## Changelog
|
||||||
|
|
||||||
|
### Current Version
|
||||||
|
- **Model Architecture**: Switched from DistilBERT to ALBERT architecture for VeraMind-Edge.
|
||||||
|
- **Memory Usage**: Reduced memory usage to approximately 10% of the previous version.
|
||||||
|
- **Inference Speed**: Slightly slower inference speed due to architectural changes.
|
||||||
|
|
||||||
|
### Previous Version
|
||||||
|
- Used DistilBERT architecture with higher memory requirements and faster inference speed.
|
||||||
|
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
This project is provided as-is, without any express or implied warranty. The maintainers are not responsible for any damages arising from the use of this software.
|
This project is provided "as-is" without any warranties. While the model strives for accuracy, it may make mistakes. Always verify predictions by consulting multiple reliable sources. Use this tool responsibly.
|
||||||
|
|
||||||
Always remember that machine learning models can make mistakes, so use this tool responsibly and critically evaluate its predictions.
|
|
||||||
|
|
||||||
## Citation
|
## License
|
||||||
|
|
||||||
If you use this model in your research, please cite it as follows:
|
This project is licensed under the [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)](https://creativecommons.org/licenses/by-nc-nd/4.0/). You may use and share this software privately, but must credit the authors, refrain from commercial use, and avoid creating derivative works.
|
||||||
|
|
||||||
|
|
||||||
|
## Feedback and Support
|
||||||
|
|
||||||
|
If you encounter any issues or have questions, feel free to reach out through the project's [Gitea Issues page](https://gitea.fabelous.app/Fabel/Fabelous-albert-uncased/issues) or contact our support team at support@fabelous.app.
|
||||||
|
|
||||||
> **VeraMind News Authenticity Checker** (2024). Retrieved from https://gitea.fabelous.app/Fabel/VeraMind by Falko Habel
|
|
4
main.py
4
main.py
|
@ -2,7 +2,7 @@ from src.Inference import VeraMindInference
|
||||||
|
|
||||||
|
|
||||||
# load model
|
# load model
|
||||||
model = VeraMindInference("path/to/VeraMind-Mini")
|
model = VeraMindInference("VeraMind-Edge")
|
||||||
|
|
||||||
|
|
||||||
text = "This is a example News Article"
|
text = "This is a example News Article"
|
||||||
|
@ -11,5 +11,5 @@ text = "This is a example News Article"
|
||||||
result = model.predict(text)
|
result = model.predict(text)
|
||||||
|
|
||||||
# Example Output
|
# Example Output
|
||||||
# {'result': 'FAKE', 'confidence': 0.9990140199661255}
|
# {'result': 'FAKE', 'confidence': 0.9981970191001892}
|
||||||
print(result)
|
print(result)
|
||||||
|
|
Loading…
Reference in New Issue