|
4 | 4 | from torch_geometric.nn import (
|
5 | 5 | GCNConv,
|
6 | 6 | GATConv,
|
| 7 | + GATv2Conv, |
7 | 8 | global_max_pool,
|
8 | 9 | global_mean_pool,
|
9 | 10 | global_add_pool,
|
10 | 11 | GraphNorm,
|
11 | 12 | )
|
12 | 13 | from torch_geometric.utils import dense_to_sparse
|
13 | 14 | from torch.optim.lr_scheduler import StepLR
|
14 |
| -from tqdm import tqdm |
| 15 | +from tqdm.notebook import tqdm |
15 | 16 | import matplotlib.pyplot as plt
|
16 | 17 | import numpy as np
|
17 | 18 | from torch.utils.data import Dataset
|
@@ -144,10 +145,10 @@ def __init__(self, input_dim, output_dim=16, dropout=0.5, pooling="max", heads=4
|
144 | 145 | self.heads = heads
|
145 | 146 |
|
146 | 147 | # Attention Conv слои
|
147 |
| - self.gat1 = GATConv(input_dim, self.hidden_dim // heads, heads=heads) |
148 |
| - self.gat2 = GATConv(self.hidden_dim, 256 // heads, heads=heads) |
149 |
| - self.gat3 = GATConv(256, 256 // heads, heads=heads) |
150 |
| - self.gat4 = GATConv(256, self.hidden_dim // heads, heads=heads) |
| 148 | + self.gat1 = GATv2Conv(input_dim, self.hidden_dim // heads, heads=heads) |
| 149 | + self.gat2 = GATv2Conv(self.hidden_dim, 256 // heads, heads=heads) |
| 150 | + self.gat3 = GATv2Conv(256, 256 // heads, heads=heads) |
| 151 | + self.gat4 = GATv2Conv(256, self.hidden_dim // heads, heads=heads) |
151 | 152 |
|
152 | 153 | # Проекции для full residual
|
153 | 154 | self.res1 = nn.Linear(input_dim, self.hidden_dim)
|
@@ -522,8 +523,8 @@ def train_model_accuracy(
|
522 | 523 | plt.show()
|
523 | 524 |
|
524 | 525 | lr = scheduler.get_last_lr()[0]
|
525 |
| - print(f"Epoch {epoch+1}, Train Loss: {avg_train_loss:.4f}, " |
526 |
| - f"Valid Loss: {avg_valid_loss:.4f}, LR: {lr:.6f}") |
| 526 | + print(f"Epoch {epoch+1}, Train Loss: {avg_train_loss * 1e4:.4f}, " |
| 527 | + f"Valid Loss: {avg_valid_loss * 1e4:.4f}, LR: {lr:.6f}") |
527 | 528 |
|
528 | 529 | return train_losses, valid_losses
|
529 | 530 |
|
|
0 commit comments