Skip to content

Update the testing pipeline#257

Merged
zezhishao merged 16 commits intoGestaltCogTeam:masterfrom
yisongfu:master
Aug 22, 2025
Merged

Update the testing pipeline#257
zezhishao merged 16 commits intoGestaltCogTeam:masterfrom
yisongfu:master

Conversation

@yisongfu
Copy link
Collaborator

Update the testing pipeline to fix potential memory overflow issues when testing on large-scale datasets.
The issue may happen when concatenating all test samples of a large dataset. The issue has been fixed, making the process more memory-efficient.

# For saving test results
self._inputs_memmap = None
self._pred_memmap = None
self._tgt_memmap = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使用_target_memmap_prediction_memap吧,保持和其他变量的一致。

raise NotImplementedError()

def test(self, train_epoch: Optional[int] = None, save_metrics: bool = False, save_results: bool = False) -> None:
def test(self, train_epoch: Optional[int] = None, save_metrics: bool = False, save_results: bool = False,) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多了一个逗号

self.logger.info(f'Test metrics saved to {os.path.join(self.ckpt_save_dir, "test_metrics.json")}.')

self.on_test_end()
self.on_test_end(save_metrics)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以将on_test_end中的代码移动到test函数中或者放到本函数中;

数据操作(例如计算、存储results和metrics)和操作之后的log尽量不要离得太远。

history_data = self.select_input_features(history_data)
future_data_4_dec = self.select_input_features(future_data)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多余的空格


# Forward pass through the model
model_return = self.model(history_data=history_data, future_data=future_data_4_dec,
model_return = self.model(history_data=history_data, future_data=future_data_4_dec,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多了一个空格


@master_only
def on_test_end(self) -> None:
def on_test_end(self, save_metrics: bool = False) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

把on_test_end内的代码移动到外面之后,这里的参数可以删掉了

prediction, target, inputs = [], [], []

for data in tqdm(self.test_data_loader):
for batch_idx, data in tqdm(enumerate(self.test_data_loader)):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enumerate要放在外面,否则会导致进度条不显示

@zezhishao zezhishao merged commit a582fc4 into GestaltCogTeam:master Aug 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants