(self, **kwargs)
Configuration Class: set kwargs as class attributes with setattr
Configuration Class: set kwargs as class attributes with setattr
Configuration Class : set kwargs as class attributes with setattr
def __init__(self, **kwargs):
        """Configuration Class: set kwargs as class attributes with setattr"""
        if kwargs is not None:
            for key, value in kwargs.items():
                if key == 'optimizer':
                    value = optimizer_dict[value]
                if key == 'rnn':
                    value = rnn_dict[value]
                if key == 'rnncell':
                    value = rnncell_dict[value]
                setattr(self, key, value)

        # Dataset directory: ex) ./datasets/cornell/
        self.dataset_dir = data_dict[self.data.lower()]

        # Data Split ex) 'train', 'valid', 'test'
        self.data_dir = self.dataset_dir.joinpath(self.mode)
        # Pickled Vocabulary
        self.word2id_path = self.dataset_dir.joinpath('word2id.pkl')
        self.id2word_path = self.dataset_dir.joinpath('id2word.pkl')

        # Pickled Dataframes
        self.sentences_path = self.data_dir.joinpath('sentences.pkl')
        self.sentence_length_path = self.data_dir.joinpath('sentence_length.pkl')
        self.conversation_length_path = self.data_dir.joinpath('conversation_length.pkl')

        # Save path
        if self.mode == 'train' and self.checkpoint is None:
            time_now = datetime.now().strftime('%Y-%m-%d_%H:%M:%S')
            self.save_path = save_dir.joinpath(self.data, self.model, time_now)
            self.logdir = self.save_path
            os.makedirs(self.save_path, exist_ok=True)
        elif self.checkpoint is not None:
            assert os.path.exists(self.checkpoint)
            self.save_path = os.path.dirname(self.checkpoint)
            self.logdir = self.save_path
def __init__ ( self , * * kwargs ) : if kwargs is not None : for key , value in kwargs . items ( ) : if key == 'optimizer' : value = optimizer_dict [ value ] if key == 'rnn' : value = rnn_dict [ value ] if key == 'rnncell' : value = rnncell_dict [ value ] setattr ( self , key , value ) # Dataset directory: ex) ./datasets/cornell/ self . dataset_dir = data_dict [ self . data . lower ( ) ] # Data Split ex) 'train', 'valid', 'test' self . data_dir = self . dataset_dir . joinpath ( self . mode ) # Pickled Vocabulary self . word2id_path = self . dataset_dir . joinpath ( 'word2id.pkl' ) self . id2word_path = self . dataset_dir . joinpath ( 'id2word.pkl' ) # Pickled Dataframes self . sentences_path = self . data_dir . joinpath ( 'sentences.pkl' ) self . sentence_length_path = self . data_dir . joinpath ( 'sentence_length.pkl' ) self . conversation_length_path = self . data_dir . joinpath ( 'conversation_length.pkl' ) # Save path if self . mode == 'train' and self . checkpoint is None : time_now = datetime . now ( ) . strftime ( '%Y-%m-%d_%H:%M:%S' ) self . save_path = save_dir . joinpath ( self . data , self . model , time_now ) self . logdir = self . save_path os . makedirs ( self . save_path , exist_ok = True ) elif self . checkpoint is not None : assert os . path . exists ( self . checkpoint ) self . save_path = os . path . dirname ( self . checkpoint ) self . logdir = self . save_path