15
15
# refs: https://github.com/delta-lab-ai/data_efficient_nopt
16
16
17
17
import glob
18
- import logging
19
18
import os
20
19
from typing import Iterator
21
20
from typing import TypeVar
29
28
from paddle .io import RandomSampler
30
29
from paddle .io import Sampler
31
30
32
- logger = logging . getLogger ( __name__ )
31
+ from ppsci . utils import logger
33
32
34
33
__all__ = [
35
34
"MultisetSampler" ,
@@ -556,12 +555,12 @@ def __init__(self, params, location, transform, train):
556
555
if self .train :
557
556
if hasattr (self .params , "train_rand_idx_path" ):
558
557
self .train_rand_idx = np .load (self .params .train_rand_idx_path )
559
- logging .info ("Randomizing train dataset using given random index path" )
558
+ logger .info ("Randomizing train dataset using given random index path" )
560
559
else :
561
560
self .train_rand_idx = range (self .data .shape [0 ])
562
561
self .train_rand_idx = self .train_rand_idx [self .pt_idxs [0 ] : self .pt_idxs [1 ]]
563
562
self .data = self .data [()][self .train_rand_idx , ...]
564
- logging .info (
563
+ logger .info (
565
564
"Getting only data idx for training set for length: {}" .format (
566
565
len (self .train_rand_idx )
567
566
)
@@ -576,7 +575,7 @@ def __init__(self, params, location, transform, train):
576
575
def _get_files_stats (self ):
577
576
self .file = self .location
578
577
with h5py .File (self .file , "r" ) as _f :
579
- logging .info ("Getting file stats from {}" .format (self .file ))
578
+ logger .info ("Getting file stats from {}" .format (self .file ))
580
579
if len (_f ["fields" ].shape ) == 4 :
581
580
self .n_demos = None
582
581
self .n_samples = _f ["fields" ].shape [0 ]
@@ -599,7 +598,7 @@ def _get_files_stats(self):
599
598
self .pt_split = self .params .pt_split
600
599
else :
601
600
self .pt_split = [0.9 , 0.1 ]
602
- logging .info (
601
+ logger .info (
603
602
"Split training set into {} for pretrain, {} for train. " .format (
604
603
self .pt_split [0 ], self .pt_split [1 ]
605
604
)
@@ -619,7 +618,7 @@ def _get_files_stats(self):
619
618
)
620
619
self .n_samples /= self .subsample
621
620
self .n_samples = int (self .n_samples )
622
- logging .info (
621
+ logger .info (
623
622
"Found data at path {}. Number of examples: {}. Image Shape: {} x {}" .format (
624
623
self .location , self .n_samples , self .img_shape_x , self .img_shape_y
625
624
)
@@ -631,12 +630,12 @@ def _get_files_stats(self):
631
630
measure_x = self .scales [- 2 ] / self .img_shape_x
632
631
measure_y = self .scales [- 1 ] / self .img_shape_y
633
632
self .measure = measure_x * measure_y
634
- logging .info (
633
+ logger .info (
635
634
"Scales for PDE are (source, tensor, sol, domain): {}" .format (
636
635
self .scales
637
636
)
638
637
)
639
- logging .info (
638
+ logger .info (
640
639
"Measure of the set is lx/nx * ly/ny = {}/{} * {}/{}" .format (
641
640
self .scales [- 2 ], self .img_shape_x , self .scales [- 1 ], self .img_shape_y
642
641
)
0 commit comments