belka_gate_fusions: trainable version
This commit is contained in:
@@ -23,7 +23,6 @@ import torch.nn.functional as F
|
||||
|
||||
# residual fusions exp
|
||||
from .residual_fusions import ResidualGateType, GatedFusionResidual
|
||||
# from residual_fusions import ResidualGateType, GatedFusionResidual
|
||||
|
||||
|
||||
class ProjectionHead(nn.Module):
|
||||
|
||||
@@ -142,3 +142,13 @@ class GatedFusionResidual(nn.Module):
|
||||
fused_vec = self.FuseARGFCat(img_feat=img_feat, text_feat=text_feat)
|
||||
|
||||
return fused_vec
|
||||
|
||||
@property
|
||||
def gate_value(self) -> float:
|
||||
"""Current gate value (image weight). 1.0 = text ignored."""
|
||||
if self.baseline_mode:
|
||||
return 1.0
|
||||
return torch.sigmoid(self.alpha).item()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ class TrainConfig:
|
||||
self,
|
||||
train_query_file: str = "Index/train_query.txt",
|
||||
val_query_file: str = "Index/test_query.txt",
|
||||
data_root: str = "/mnt/data1tb/cvgl_datasets/UAV-GeoLoc",
|
||||
output_dir: str = "out/caption_test",
|
||||
data_root: str = "/media/servml/SSD_2_TB/datasets/cvgl_datasets/UAV-GeoLoc",
|
||||
output_dir: str = "out/caption_test_exp_gate_SRGF",
|
||||
epochs: int = 10,
|
||||
batch_size: int = 128,
|
||||
num_workers: int = 4,
|
||||
|
||||
Reference in New Issue
Block a user