Pdf2 model task (#33)

* add needed dependency

* add extract_model_and_implement pipeline

* add merge_file_to_model_dict_to_model_dict

* implement `rdagent\app\model_implementation\eval.py`

* Running benchmark

* refine import

---------

Co-authored-by: Young <afe.young@gmail.com>
This commit is contained in:
Xinjie Shen
2024-06-30 23:31:00 +08:00
committed by GitHub
parent 43cb4a564b
commit b796b90cce
14 changed files with 344 additions and 45 deletions
@@ -74,6 +74,9 @@ class DirGNNConv(torch.nn.Module):
return f"{self.__class__.__name__}({self.conv_in}, alpha={self.alpha})"
model_cls = DirGNNConv
if __name__ == "__main__":
node_features = torch.load("node_features.pt")
edge_index = torch.load("edge_index.pt")
@@ -183,6 +183,9 @@ class GPSConv(torch.nn.Module):
)
model_cls = GPSConv
if __name__ == "__main__":
node_features = torch.load("node_features.pt")
edge_index = torch.load("edge_index.pt")
@@ -166,6 +166,7 @@ class LINKX(torch.nn.Module):
f"out_channels={self.out_channels})"
)
model_cls = LINKX
if __name__ == "__main__":
node_features = torch.load("node_features.pt")
@@ -99,17 +99,14 @@ class PMLP(torch.nn.Module):
return f"{self.__class__.__name__}({self.in_channels}, " f"{self.out_channels}, num_layers={self.num_layers})"
model_cls = PMLP
if __name__ == "__main__":
node_features = torch.load("node_features.pt")
edge_index = torch.load("edge_index.pt")
# Model instantiation and forward pass
model = PMLP(
in_channels=node_features.size(-1),
hidden_channels=node_features.size(-1),
out_channels=node_features.size(-1),
num_layers=1,
)
model = PMLP(in_channels=node_features.size(-1), hidden_channels=node_features.size(-1), out_channels=node_features.size(-1), num_layers=1)
output = model(node_features, edge_index)
# Save output to a file
@@ -1176,6 +1176,9 @@ class ViSNet(torch.nn.Module):
return y, None
model_cls = ViSNet
if __name__ == "__main__":
node_features = torch.load("node_features.pt")
edge_index = torch.load("edge_index.pt")