Beispiel #1
0
    def load_dataset(cls, dataset_id: str) -> Dataset:
        """
        Load dataset from JSON file.

        :param dataset_id: dataset ID
        """
        dataset_path = DatasetPath(dataset_id)
        metadata = cls.__load_json(dataset_path.metadata_file, DatasetMetadata)
        dataset_config = cls.__load_json(dataset_path.dataset_config_file,
                                         DatasetConfig)
        module = ModuleUtils.import_module(dataset_path.module_dir,
                                           dataset_path.module_name)
        dataset_config.module = module
        dataset = Dataset(dataset_id=dataset_id,
                          metadata=metadata,
                          dataset_config=dataset_config)
        dataset.module = module
        return dataset
Beispiel #2
0
    def load_job(cls, job_id: str) -> Job:
        """
        Load job from JSON file.

        :param job_id: dataset ID
        """
        job_path = JobPath(job_id)
        metadata = cls.__load_json(job_path.metadata_file, JobMetadata)
        job_config = cls.__load_json(job_path.job_config_file, JobConfig)
        train_config = cls.__load_json(job_path.train_config_file, TrainConfig)
        aggregate_config = cls.__load_json(job_path.aggregate_config_file,
                                           AggregateConfig)
        module = ModuleUtils.import_module(job_path.module_dir,
                                           job_path.module_name)
        job_config.module = module
        train_config.module = module
        aggregate_config.module = module
        job = Job(job_id=job_id,
                  metadata=metadata,
                  job_config=job_config,
                  train_config=train_config,
                  aggregate_config=aggregate_config)
        job.module = module
        return job