-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_model.py
More file actions
32 lines (22 loc) · 934 Bytes
/
debug_model.py
File metadata and controls
32 lines (22 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from omegaconf import OmegaConf
from hydra.utils import instantiate
from pytorch_lightning import LightningDataModule
import log_set
import torch
from tqdm.auto import tqdm
from point_transformer.models import ClsPointTransformer
if __name__ == "__main__":
cls = ClsPointTransformer(6, 10, num_transformer_blocks=4)
config = OmegaConf.load("./exp/modelnet10/config.yaml")
datamodule: LightningDataModule = instantiate(config.datasets)
datamodule.setup("fit")
# datamodule.setup("validate")
class_mapping = datamodule.get_class_mapping()
config.model.num_classes = len(class_mapping)
model = instantiate(config.model)
device = torch.device("cuda")
dataloader = datamodule.train_dataloader()
model.to(device)
with torch.autocast(device.type):
for idx, batch in tqdm(enumerate(dataloader), total=len(dataloader)):
batch = model.forward_data(batch.to(device))