swirl commited on
Commit
88e6227
·
verified ·
1 Parent(s): b9b6890

Upload config.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. config.py +65 -0
config.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Two-Tower Configuration
3
+
4
+ Architecture constants for Isengard (User Tower) and Mordor (Wine Tower).
5
+ """
6
+
7
+ # =============================================================================
8
+ # EMBEDDING DIMENSIONS
9
+ # =============================================================================
10
+
11
+ # Input embedding dimension (google-text-embedding-004)
12
+ EMBEDDING_DIM = 768
13
+
14
+ # Output vector dimensions for both towers (must match for dot product)
15
+ USER_VECTOR_DIM = 128
16
+ WINE_VECTOR_DIM = 128
17
+
18
+ # Hidden layer dimension
19
+ HIDDEN_DIM = 256
20
+
21
+ # =============================================================================
22
+ # CATEGORICAL FEATURES
23
+ # =============================================================================
24
+
25
+ # Feature list matching constants.py CATEGORICAL_FEATURES
26
+ CATEGORICAL_FEATURES = [
27
+ "color",
28
+ "type",
29
+ "style",
30
+ "climate_type",
31
+ "climate_band",
32
+ "vintage_band",
33
+ ]
34
+
35
+ # Categorical feature vocabulary sizes (approximate, for one-hot encoding)
36
+ CATEGORICAL_VOCAB_SIZES = {
37
+ "color": 5, # red, white, rosé, orange, sparkling
38
+ "type": 4, # still, sparkling, fortified, dessert
39
+ "style": 10, # Natural, Organic, Biodynamic, etc.
40
+ "climate_type": 4, # cool, moderate, warm, hot
41
+ "climate_band": 4, # cool, moderate, warm, hot
42
+ "vintage_band": 4, # young, developing, mature, non_vintage
43
+ }
44
+
45
+ # Total categorical encoding dimension
46
+ CATEGORICAL_ENCODING_DIM = sum(CATEGORICAL_VOCAB_SIZES.values()) # ~31
47
+
48
+ # =============================================================================
49
+ # TRAINING PARAMETERS
50
+ # =============================================================================
51
+
52
+ TRIPLET_MARGIN = 0.2 # Margin for triplet loss
53
+ LEARNING_RATE = 1e-4
54
+ BATCH_SIZE = 32
55
+ POSITIVE_RATING_THRESHOLD = 4.0 # Ratings >= 4 are positive samples
56
+
57
+ # =============================================================================
58
+ # HUGGINGFACE INFERENCE
59
+ # =============================================================================
60
+
61
+ # Model ID on HuggingFace Hub (for model upload/download)
62
+ HF_MODEL_ID = "swirl/two-tower-recommender"
63
+
64
+ # Inference Endpoint URL is read from settings.HF_TWO_TOWER_ENDPOINT_URL
65
+ # API Token is read from settings.HF_API_TOKEN (same as CLIP)