leeeov4 commited on
Commit
031a339
·
verified ·
1 Parent(s): 4bfc5b4

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +63 -0
README.md ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - tf-keras
4
+ - bert
5
+ - alberto
6
+ - multi-task-learning
7
+ - text-classification
8
+ - italian
9
+ - gender-classification
10
+ - ideology-detection
11
+ library_name: tf-keras
12
+ language:
13
+ - it
14
+ datasets:
15
+ - custom
16
+ ---
17
+
18
+ # PIDIT: Modello Multi-Task BERT + ALBERTO per analisi ideologica e di genere 🇮🇹
19
+
20
+ Questo modello `tf.keras` unisce due encoder pre-addestrati (`BERT` e `ALBERTO`) per effettuare predizioni multi-task su testi in italiano.
21
+ È progettato per classificare:
22
+
23
+ - 🧑‍🤝‍🧑 **Genere** dell'autore (binary classification)
24
+ - 🏛️ **Ideologia binaria** (es. conservatore vs progressista)
25
+ - 🧭 **Ideologia multiclasse** (4 classi ideologiche)
26
+
27
+ ## ✨ Architettura
28
+
29
+ - `TFBertModel` da `bert-base-italian-uncased` (non fine-tuned)
30
+ - `TFAutoModel` da `alberto-base-uncased` (non fine-tuned)
31
+ - Layer di concatenazione e densi condivisi
32
+ - 3 teste di output:
33
+ - `gender`: `Dense(1, activation="sigmoid")`
34
+ - `ideology_binary`: `Dense(1, activation="sigmoid")`
35
+ - `ideology_multiclass`: `Dense(4, activation="softmax")`
36
+
37
+ ## 📥 Input
38
+
39
+ Il modello accetta **6 input**:
40
+ - `bert_input_ids`, `bert_token_type_ids`, `bert_attention_mask`
41
+ - `alberto_input_ids`, `alberto_token_type_ids`, `alberto_attention_mask`
42
+
43
+ Tutti con shape `(batch_size, max_length)`.
44
+
45
+ ---
46
+
47
+ ## 🚀 Utilizzo
48
+
49
+ ### 1. Caricamento del modello
50
+
51
+ ```python
52
+ from huggingface_hub import snapshot_download
53
+ from transformers import TFBertModel, TFAutoModel
54
+ import tensorflow as tf
55
+
56
+ # Scarica localmente il modello
57
+ model_path = snapshot_download("leeeov4/PIDIT")
58
+
59
+ # Carica il modello
60
+ model = tf.keras.models.load_model(model_path, custom_objects={
61
+ "TFBertModel": TFBertModel,
62
+ "TFAutoModel": TFAutoModel
63
+ })