YOUSSEF88 commited on
Commit
d9187c8
·
verified ·
1 Parent(s): 3238dca

Upload structa/config.py

Browse files
Files changed (1) hide show
  1. structa/config.py +65 -0
structa/config.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dataclasses import dataclass, field
2
+ from typing import Optional
3
+
4
+
5
+ @dataclass
6
+ class StruCTAConfig:
7
+ """Configuration for StruCTA privacy-preserving transformer."""
8
+
9
+ # Model dimensions
10
+ hidden_dim: int = 768
11
+ num_encoder_layers: int = 12
12
+ num_decoder_layers: int = 12
13
+ num_heads: int = 12
14
+ ffn_dim: int = 3072
15
+ dropout: float = 0.1
16
+ attention_dropout: float = 0.1
17
+
18
+ # Graph structural encodings (Graphormer)
19
+ max_degree: int = 512
20
+ max_spatial_dist: int = 128
21
+ max_edge_features: int = 32
22
+ use_centrality_encoding: bool = True
23
+ use_spatial_encoding: bool = True
24
+ use_edge_encoding: bool = True
25
+
26
+ # Abstract entity types
27
+ num_abstract_types: int = 32
28
+ abstract_type_map: dict = field(default_factory=lambda: {
29
+ "PERSON": 0,
30
+ "ORG": 1,
31
+ "LOC": 2,
32
+ "GPE": 3,
33
+ "MONEY": 4,
34
+ "DATE": 5,
35
+ "PHONE": 6,
36
+ "EMAIL": 7,
37
+ "SSN": 8,
38
+ "ID": 9,
39
+ "PRODUCT": 10,
40
+ "EVENT": 11,
41
+ "MISC": 12,
42
+ })
43
+
44
+ # Vocabulary
45
+ vocab_size: int = 50000
46
+
47
+ # Privacy
48
+ use_dp_training: bool = True
49
+ dp_epsilon: float = 3.0
50
+ dp_delta: float = 1e-5
51
+ dp_clip_norm: float = 1.0
52
+
53
+ # Decoder cross-modal
54
+ max_graph_nodes: int = 256
55
+
56
+ # Training
57
+ max_seq_length: int = 512
58
+ batch_size: int = 32
59
+ learning_rate: float = 2e-4
60
+ warmup_steps: int = 60000
61
+ num_training_steps: int = 1000000
62
+
63
+ # Inference
64
+ use_privacy_verification: bool = True
65
+ privacy_threshold: float = 0.95