Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
- ko
|
| 5 |
+
- zh
|
| 6 |
+
- ja
|
| 7 |
+
- es
|
| 8 |
+
- fr
|
| 9 |
+
- ru
|
| 10 |
+
- hi
|
| 11 |
+
metrics:
|
| 12 |
+
- accuracy
|
| 13 |
+
base_model:
|
| 14 |
+
- distilbert/distilbert-base-multilingual-cased
|
| 15 |
+
pipeline_tag: text-classification
|
| 16 |
+
---
|
| 17 |
+
# Model Card: BERTopic Model for Serverless Inference
|
| 18 |
+
|
| 19 |
+
## Model Description
|
| 20 |
+
This is a BERTopic model trained for **topic modeling** on a multilingual dataset. The model is serialized in **safetensors** format for optimized loading and is designed for **serverless inference** in cloud environments.
|
| 21 |
+
|
| 22 |
+
### Features
|
| 23 |
+
- **Multilingual support** (Supports 8 languages)
|
| 24 |
+
- **Pre-trained and fine-tuned on synthetic and real tourist reviews**
|
| 25 |
+
- **Safetensors format for faster and safer model loading**
|
| 26 |
+
- **Optimized for serverless architectures (FastAPI, AWS Lambda, Cloud Functions, etc.)**
|
| 27 |
+
|
| 28 |
+
## Intended Use
|
| 29 |
+
- **Tourism feedback analysis**
|
| 30 |
+
- **Customer review topic modeling**
|
| 31 |
+
- **Data-driven decision-making for tourism offices**
|
| 32 |
+
- **Research on multilingual topic modeling**
|
| 33 |
+
|
| 34 |
+
## Model Details
|
| 35 |
+
- **Architecture**: BERTopic
|
| 36 |
+
- **Embedding Model**: `paraphrase-multilingual-MiniLM-L12-v2`
|
| 37 |
+
- **Dimensionality Reduction**: UMAP
|
| 38 |
+
- **Clustering Algorithm**: HDBSCAN
|
| 39 |
+
- **Vectorizer**: CountVectorizer (TF-IDF preprocessing)
|
| 40 |
+
- **Languages**: English, Spanish, French, Chinese, Japanese, German, Korean, Tagalog
|
| 41 |
+
- **Dataset**: 160k synthetic and real tourist reviews categorized by emotional tone and topics
|
| 42 |
+
|
| 43 |
+
## Model Performance
|
| 44 |
+
- **Topic Coherence Score**: *XX.XX*
|
| 45 |
+
- **Diversity Score**: *XX.XX*
|
| 46 |
+
- **Sentiment Analysis Accuracy**: *≥ 70%*
|
| 47 |
+
|
| 48 |
+
## How to Use
|
| 49 |
+
### Load the Model:
|
| 50 |
+
```python
|
| 51 |
+
from bertopic import BERTopic
|
| 52 |
+
from safetensors.torch import load_file
|
| 53 |
+
|
| 54 |
+
# Load model
|
| 55 |
+
model = BERTopic.load("path/to/model.safetensors")
|
| 56 |
+
```
|
| 57 |
+
### Perform Topic Modeling:
|
| 58 |
+
```python
|
| 59 |
+
docs = ["The hotel had a great view of the beach and excellent service.",
|
| 60 |
+
"Transportation was a bit difficult to find late at night."]
|
| 61 |
+
|
| 62 |
+
topics, probs = model.transform(docs)
|
| 63 |
+
print(topics)
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
## Deployment Guide
|
| 67 |
+
- **AWS Lambda / FastAPI**: Ensure `safetensors`, `bertopic`, and `sentence-transformers` are included in the dependencies.
|
| 68 |
+
- **Memory Optimization**: Use `safetensors` for faster inference and reduced memory footprint.
|
| 69 |
+
- **Serverless Scaling**: Load the model in memory at cold start and reuse for subsequent requests.
|
| 70 |
+
|
| 71 |
+
## Limitations
|
| 72 |
+
- **Topic coherence may vary by language**
|
| 73 |
+
- **Sensitive to dataset biases**
|
| 74 |
+
- **Not suitable for real-time low-latency applications (<50ms response time)**
|
| 75 |
+
|
| 76 |
+
## License
|
| 77 |
+
[Insert License Here]
|
| 78 |
+
|
| 79 |
+
## Citation
|
| 80 |
+
```
|
| 81 |
+
@inproceedings{your_citation,
|
| 82 |
+
title={BERTopic Model for Multilingual Tourism Feedback},
|
| 83 |
+
author={Your Name},
|
| 84 |
+
year={2025}
|
| 85 |
+
}
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
---
|
| 89 |
+
*For inquiries or contributions, please open an issue on the Hugging Face repository.*
|