sus
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -9,16 +9,11 @@ base_model:
|
|
9 |
pipeline_tag: text-classification
|
10 |
---
|
11 |
|
12 |
-
# Name
|
13 |
|
14 |
[](https://www.example.com/donate?crypto=YOUR_CRYPTO_ID)
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
- **Reinforcement Learning Approach:** A custom Gym environment coupled with a PPO agent.
|
19 |
-
- **Transformer-based Approach:** Fine-tuning a transformer model (using Hugging Face Transformers) for binary classification with the final model saved in the `.safetensors` format.
|
20 |
-
|
21 |
-
Both models are equipped with detailed testing (including confusion matrix visualization) and API deployment capabilities.
|
22 |
|
23 |
---
|
24 |
|
@@ -63,25 +58,38 @@ The goal of this project is to determine if a given first name is "real" (from a
|
|
63 |
```bash
|
64 |
pip install -r requirements.txt
|
65 |
```
|
66 |
-
|
67 |
-
> **Note:** If you're using Google Colab, you can run each provided code block directly.
|
68 |
-
|
69 |
-
3. **Dependencies:**
|
70 |
-
|
71 |
-
- `transformers`
|
72 |
-
- `datasets`
|
73 |
-
- `safetensors`
|
74 |
-
- `stable-baselines3`
|
75 |
-
- `gym`
|
76 |
-
- `flask`
|
77 |
-
- `scikit-learn`
|
78 |
-
- `seaborn`
|
79 |
-
- `huggingface_hub`
|
80 |
-
|
81 |
---
|
82 |
|
83 |
## Usage
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
### Training
|
86 |
|
87 |
- **Reinforcement Learning Model:**
|
|
|
9 |
pipeline_tag: text-classification
|
10 |
---
|
11 |
|
12 |
+
# Last Name Classification Model
|
13 |
|
14 |
[](https://www.example.com/donate?crypto=YOUR_CRYPTO_ID)
|
15 |
|
16 |
+
A simple Transformer-based classifier that checks if a provided last name is likely to be **real** (LABEL_1) or **fake** (LABEL_0). This can be helpful in validating contact form submissions, preventing bot entries, or for general name classification tasks.
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
---
|
19 |
|
|
|
58 |
```bash
|
59 |
pip install -r requirements.txt
|
60 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
---
|
62 |
|
63 |
## Usage
|
64 |
|
65 |
+
```bash
|
66 |
+
from transformers import pipeline
|
67 |
+
|
68 |
+
# Replace with your model directory or Hugging Face model hub link
|
69 |
+
model_dir = "/kaggle/input/name-dataset/transformers_name_classifier_safetensors"
|
70 |
+
|
71 |
+
# Load the model pipeline
|
72 |
+
classifier = pipeline(
|
73 |
+
"text-classification",
|
74 |
+
model=model_dir,
|
75 |
+
tokenizer=model_dir,
|
76 |
+
framework="pt"
|
77 |
+
)
|
78 |
+
|
79 |
+
# Test the model
|
80 |
+
test_names = ["musk", "zzzzzz", "uhyhu", "trump"]
|
81 |
+
for name in test_names:
|
82 |
+
result = classifier(name)
|
83 |
+
label = result[0]['label']
|
84 |
+
score = result[0]['score']
|
85 |
+
print(f"Name: {name} => Prediction: {label}, Score: {score:.4f}")
|
86 |
+
```
|
87 |
+
```bash
|
88 |
+
Name: musk => Prediction: LABEL_1, Score: 0.9167
|
89 |
+
Name: zzzzzz => Prediction: LABEL_0, Score: 0.9991
|
90 |
+
Name: uhyhu => Prediction: LABEL_0, Score: 0.9944
|
91 |
+
Name: trump => Prediction: LABEL_1, Score: 0.9998
|
92 |
+
```
|
93 |
### Training
|
94 |
|
95 |
- **Reinforcement Learning Model:**
|