Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +32 -0
- added_tokens.json +3 -0
- best_params.json +13 -0
- bpe.codes +0 -0
- config.json +74 -0
- model.safetensors +3 -0
- optuna.db +3 -0
- tokenizer_config.json +56 -0
- vocab.txt +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
optuna.db filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: vi
|
| 3 |
+
license: cc-by-nc-sa-4.0
|
| 4 |
+
library_name: pytorch
|
| 5 |
+
tags:
|
| 6 |
+
- esg
|
| 7 |
+
- phobert
|
| 8 |
+
- multi-label
|
| 9 |
+
- vietnamese
|
| 10 |
+
- text-classification
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# huypham71/esg-topic
|
| 14 |
+
|
| 15 |
+
PhoBERT multi-head (sigmoid) cho ESG — backbone `vinai/phobert-base`, các đầu: `['env', 'soc', 'gov']`.
|
| 16 |
+
Đây là kiến trúc **tùy biến** (một encoder + nhiều đầu nhị phân độc lập, masked BCE),
|
| 17 |
+
KHÔNG phải `AutoModelForSequenceClassification`, nên cần dùng code `esgwash` để tải.
|
| 18 |
+
|
| 19 |
+
- **Thresholds theo từng đầu** (tune trên tập val, tối đa hóa F1): `{'env': 0.27, 'soc': 0.13, 'gov': 0.46}`
|
| 20 |
+
- File: `model.safetensors` (backbone + các đầu), tokenizer PhoBERT, `config.json`.
|
| 21 |
+
|
| 22 |
+
## Cách tải
|
| 23 |
+
```python
|
| 24 |
+
import json
|
| 25 |
+
from esgwash.models.trainer import MultiHeadTrainer
|
| 26 |
+
from huggingface_hub import snapshot_download
|
| 27 |
+
|
| 28 |
+
d = snapshot_download("huypham71/esg-topic")
|
| 29 |
+
cfg = json.load(open(f"{d}/config.json"))
|
| 30 |
+
model = MultiHeadTrainer(cfg).load(d)
|
| 31 |
+
probs = model.predict_proba(["câu tiếng Việt ..."]) # tự word-segment bên trong
|
| 32 |
+
```
|
added_tokens.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"<mask>": 64000
|
| 3 |
+
}
|
best_params.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"params": {
|
| 3 |
+
"lr": 2.7396836004694616e-05,
|
| 4 |
+
"batch_size": 16,
|
| 5 |
+
"warmup_ratio": 0.06467163677523774,
|
| 6 |
+
"weight_decay": 0.019448553647326953,
|
| 7 |
+
"dropout": 0.05249460840378278
|
| 8 |
+
},
|
| 9 |
+
"val_macro_f1": 0.8571,
|
| 10 |
+
"epochs": 10,
|
| 11 |
+
"n_trials": 20,
|
| 12 |
+
"tuned_at": "2026-06-13T10:58:20"
|
| 13 |
+
}
|
bpe.codes
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
config.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backbone": "vinai/phobert-base",
|
| 3 |
+
"en_backbone": "roberta-base",
|
| 4 |
+
"zero_shot_backbone": "xlm-roberta-base",
|
| 5 |
+
"max_length": 256,
|
| 6 |
+
"word_segment": true,
|
| 7 |
+
"labels": [
|
| 8 |
+
"env",
|
| 9 |
+
"soc",
|
| 10 |
+
"gov"
|
| 11 |
+
],
|
| 12 |
+
"loss": "masked_bce",
|
| 13 |
+
"pos_weight": "auto",
|
| 14 |
+
"train": {
|
| 15 |
+
"lr": 2.7396836004694616e-05,
|
| 16 |
+
"batch_size": 16,
|
| 17 |
+
"epochs": 10,
|
| 18 |
+
"warmup_ratio": 0.06467163677523774,
|
| 19 |
+
"weight_decay": 0.019448553647326953,
|
| 20 |
+
"seeds": [
|
| 21 |
+
42,
|
| 22 |
+
43,
|
| 23 |
+
44,
|
| 24 |
+
45,
|
| 25 |
+
46
|
| 26 |
+
]
|
| 27 |
+
},
|
| 28 |
+
"threshold_tuning": "per_label_f1",
|
| 29 |
+
"tune": {
|
| 30 |
+
"max_epochs": 10,
|
| 31 |
+
"space": {
|
| 32 |
+
"lr": [
|
| 33 |
+
1e-05,
|
| 34 |
+
5e-05
|
| 35 |
+
],
|
| 36 |
+
"batch_size": [
|
| 37 |
+
16,
|
| 38 |
+
32
|
| 39 |
+
],
|
| 40 |
+
"warmup_ratio": [
|
| 41 |
+
0.0,
|
| 42 |
+
0.2
|
| 43 |
+
],
|
| 44 |
+
"weight_decay": [
|
| 45 |
+
0.001,
|
| 46 |
+
0.1
|
| 47 |
+
],
|
| 48 |
+
"dropout": [
|
| 49 |
+
0.05,
|
| 50 |
+
0.3
|
| 51 |
+
]
|
| 52 |
+
}
|
| 53 |
+
},
|
| 54 |
+
"cross_label": {
|
| 55 |
+
"confidence": 0.9,
|
| 56 |
+
"probs_path": "data/processed/gold/esgbert_probs.parquet",
|
| 57 |
+
"table_path": "data/processed/gold/topic_labeled.parquet"
|
| 58 |
+
},
|
| 59 |
+
"data": {
|
| 60 |
+
"masked_table": "data/processed/gold/topic_masked.parquet"
|
| 61 |
+
},
|
| 62 |
+
"output_dir": "outputs/models/topic",
|
| 63 |
+
"heads": [
|
| 64 |
+
"env",
|
| 65 |
+
"soc",
|
| 66 |
+
"gov"
|
| 67 |
+
],
|
| 68 |
+
"dropout": 0.05249460840378278,
|
| 69 |
+
"thresholds": {
|
| 70 |
+
"env": 0.27,
|
| 71 |
+
"soc": 0.13,
|
| 72 |
+
"gov": 0.46
|
| 73 |
+
}
|
| 74 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2912e27e8e08d0bf7066a948afefa53a38db7c5cd93186e7ff925a43a1c2872d
|
| 3 |
+
size 540026964
|
optuna.db
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aadd65a05defec1415e4457fcc245e884bfed1be61c0979253b77c7796ea2f8f
|
| 3 |
+
size 131072
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "<s>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"1": {
|
| 12 |
+
"content": "<pad>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"2": {
|
| 20 |
+
"content": "</s>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
},
|
| 27 |
+
"3": {
|
| 28 |
+
"content": "<unk>",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
},
|
| 35 |
+
"64000": {
|
| 36 |
+
"content": "<mask>",
|
| 37 |
+
"lstrip": false,
|
| 38 |
+
"normalized": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"special": true
|
| 42 |
+
}
|
| 43 |
+
},
|
| 44 |
+
"backend": "custom",
|
| 45 |
+
"bos_token": "<s>",
|
| 46 |
+
"cls_token": "<s>",
|
| 47 |
+
"eos_token": "</s>",
|
| 48 |
+
"is_local": false,
|
| 49 |
+
"local_files_only": false,
|
| 50 |
+
"mask_token": "<mask>",
|
| 51 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 52 |
+
"pad_token": "<pad>",
|
| 53 |
+
"sep_token": "</s>",
|
| 54 |
+
"tokenizer_class": "PhobertTokenizer",
|
| 55 |
+
"unk_token": "<unk>"
|
| 56 |
+
}
|
vocab.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|