當前位置: 首頁>>代碼示例>>Python>>正文


Python comet_ml.Experiment方法代碼示例

本文整理匯總了Python中comet_ml.Experiment方法的典型用法代碼示例。如果您正苦於以下問題:Python comet_ml.Experiment方法的具體用法?Python comet_ml.Experiment怎麽用?Python comet_ml.Experiment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在comet_ml的用法示例。


在下文中一共展示了comet_ml.Experiment方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: experiment

# 需要導入模塊: import comet_ml [as 別名]
# 或者: from comet_ml import Experiment [as 別名]
def experiment(self, *args, **kwargs):
        import comet_ml
        try:
            self.cometml_experiment = comet_ml.Experiment(log_code=False)
        except Exception:
            self.cometml_experiment = None
            logger.error(
                "comet_ml.Experiment() had errors. Perhaps you need to define COMET_API_KEY")
            return

        logger.info("comet.experiment() called......")
        cli = self._make_command_line(args)
        self.cometml_experiment.set_code(cli)
        self.cometml_experiment.set_filename("Ludwig CLI")
        self._log_html(cli)
        config = comet_ml.get_config()
        self._save_config(config) 
開發者ID:uber,項目名稱:ludwig,代碼行數:19,代碼來源:comet.py

示例2: train

# 需要導入模塊: import comet_ml [as 別名]
# 或者: from comet_ml import Experiment [as 別名]
def train(self, *args, **kwargs):
        import comet_ml
        try:
            self.cometml_experiment = comet_ml.Experiment(log_code=False)
        except Exception:
            self.cometml_experiment = None
            logger.error(
                "comet_ml.Experiment() had errors. Perhaps you need to define COMET_API_KEY")
            return

        logger.info("comet.train() called......")
        cli = self._make_command_line(args)
        self.cometml_experiment.set_code(cli)
        self.cometml_experiment.set_filename("Ludwig CLI")
        self._log_html(cli)
        config = comet_ml.get_config()
        self._save_config(config) 
開發者ID:uber,項目名稱:ludwig,代碼行數:19,代碼來源:comet.py

示例3: init_callbacks

# 需要導入模塊: import comet_ml [as 別名]
# 或者: from comet_ml import Experiment [as 別名]
def init_callbacks(self):
        self.callbacks.append(
            ModelCheckpoint(
                filepath=os.path.join(self.config.callbacks.checkpoint_dir, '%s-{epoch:02d}-{val_loss:.2f}.hdf5' % self.config.exp.name),
                monitor=self.config.callbacks.checkpoint_monitor,
                mode=self.config.callbacks.checkpoint_mode,
                save_best_only=self.config.callbacks.checkpoint_save_best_only,
                save_weights_only=self.config.callbacks.checkpoint_save_weights_only,
                verbose=self.config.callbacks.checkpoint_verbose,
            )
        )

        self.callbacks.append(
            TensorBoard(
                log_dir=self.config.callbacks.tensorboard_log_dir,
                write_graph=self.config.callbacks.tensorboard_write_graph,
            )
        )

        if hasattr(self.config,"comet_api_key"):
            from comet_ml import Experiment
            experiment = Experiment(api_key=self.config.comet_api_key, project_name=self.config.exp_name)
            experiment.disable_mp()
            experiment.log_multiple_params(self.config)
            self.callbacks.append(experiment.get_keras_callback()) 
開發者ID:Ahmkel,項目名稱:Keras-Project-Template,代碼行數:27,代碼來源:simple_mnist_trainer.py

示例4: __init__

# 需要導入模塊: import comet_ml [as 別名]
# 或者: from comet_ml import Experiment [as 別名]
def __init__(self, experiment=None, api_key=None, tags=None, **kwargs):
        """
        Args:
            experiment (comet_ml.Experiment): if provided, invalidate all other arguments
            api_key (str): your comet.ml API key
            tags (list[str]): experiment tags
            kwargs: other arguments passed to :class:`comet_ml.Experiment`.
        """
        if experiment is not None:
            self._exp = experiment
            assert api_key is None and tags is None and len(kwargs) == 0
        else:
            from comet_ml import Experiment
            kwargs.setdefault('log_code', True)  # though it's not functioning, git patch logging requires it
            kwargs.setdefault('auto_output_logging', None)
            self._exp = Experiment(api_key=api_key, **kwargs)
            if tags is not None:
                self._exp.add_tags(tags)

        self._exp.set_code("Code logging is impossible because there are too many files ...")
        self._exp.log_dependency('tensorpack', __git_version__) 
開發者ID:microsoft,項目名稱:petridishnn,代碼行數:23,代碼來源:monitor.py

示例5: init_comet

# 需要導入模塊: import comet_ml [as 別名]
# 或者: from comet_ml import Experiment [as 別名]
def init_comet(params, trainer):
    if params['comet_key']:
        from comet_ml import Experiment
        experiment = Experiment(api_key=params['comet_key'], project_name=params['comet_project_name'], log_code=False)
        hyperparams = {
            name: str(params[name]) for name in params
        }
        experiment.log_multiple_params(hyperparams)
        trainer.register_plugin(CometPlugin(
            experiment, [
                'G_loss.epoch_mean',
                'D_loss.epoch_mean',
                'D_real.epoch_mean',
                'D_fake.epoch_mean',
                'sec.kimg',
                'sec.tick',
                'kimg_stat'
            ] + (['depth', 'alpha'] if params['progressive_growing'] else [])
        ))
    else:
        print('Comet_ml logging disabled.') 
開發者ID:deepsound-project,項目名稱:pggan-pytorch,代碼行數:23,代碼來源:train.py

示例6: __init__

# 需要導入模塊: import comet_ml [as 別名]
# 或者: from comet_ml import Experiment [as 別名]
def __init__(self, experiment=None, tags=None, **kwargs):
        """
        Args:
            experiment (comet_ml.Experiment): if provided, invalidate all other arguments
            tags (list[str]): experiment tags
            kwargs: arguments used to initialize :class:`comet_ml.Experiment`,
                such as project name, API key, etc.
                Refer to its documentation for details.
        """
        if experiment is not None:
            self._exp = experiment
            assert tags is None and len(kwargs) == 0
        else:
            from comet_ml import Experiment
            kwargs.setdefault('log_code', True)  # though it's not functioning, git patch logging requires it
            kwargs.setdefault('auto_output_logging', None)
            self._exp = Experiment(**kwargs)
            if tags is not None:
                self._exp.add_tags(tags)

        self._exp.set_code("Code logging is impossible ...")
        self._exp.log_dependency('tensorpack', __git_version__) 
開發者ID:junsukchoe,項目名稱:ADL,代碼行數:24,代碼來源:monitor.py

示例7: init_comet

# 需要導入模塊: import comet_ml [as 別名]
# 或者: from comet_ml import Experiment [as 別名]
def init_comet(params, trainer):
    if params['comet_key'] is not None:
        from comet_ml import Experiment
        from trainer.plugins import CometPlugin
        experiment = Experiment(api_key=params['comet_key'], log_code=False)
        hyperparams = {
            name: param_to_string(params[name]) for name in tag_params
        }
        experiment.log_multiple_params(hyperparams)
        trainer.register_plugin(CometPlugin(
            experiment, [
                ('training_loss', 'epoch_mean'),
                'validation_loss',
                'test_loss'
            ]
        )) 
開發者ID:deepsound-project,項目名稱:samplernn-pytorch,代碼行數:18,代碼來源:train.py

示例8: experiment

# 需要導入模塊: import comet_ml [as 別名]
# 或者: from comet_ml import Experiment [as 別名]
def experiment(self):
        """
        The :class:`comet_ml.Experiment` instance.
        """
        return self._exp 
開發者ID:microsoft,項目名稱:petridishnn,代碼行數:7,代碼來源:monitor.py

示例9: run_main_loop

# 需要導入模塊: import comet_ml [as 別名]
# 或者: from comet_ml import Experiment [as 別名]
def run_main_loop(args, train_estimator, predict_estimator):
	total_steps = 0
	train_steps = math.ceil(args.train_examples / args._batch_size)
	eval_steps  = math.ceil(args.eval_examples  / args._batch_size)

	if args.use_comet:
		experiment = Experiment(api_key=comet_ml_api_key, project_name=comet_ml_project, workspace=comet_ml_workspace)
		experiment.log_parameters(vars(args))
		experiment.add_tags(args.tag)
		experiment.set_name(model_name(args))
	else:
		experiment = None

	prefetch_inception_model()

	with tf.gfile.Open(os.path.join(suffixed_folder(args, args.result_dir), "eval.txt"), "a") as eval_file:
		for epoch in range(0, args.epochs, args.predict_every):

			logger.info(f"Training epoch {epoch}")
			train_estimator.train(input_fn=train_input_fn, steps=train_steps * args.predict_every)
			total_steps += train_steps * args.predict_every

			if args.use_comet:
				experiment.set_step(epoch)

			# logger.info(f"Evaluate {epoch}")
			# evaluation = predict_estimator.evaluate(input_fn=eval_input_fn, steps=eval_steps)
			# logger.info(evaluation)
			# save_evaluation(args, eval_file, evaluation, epoch, total_steps)
			
			# if args.use_comet:
			# 	experiment.log_metrics(evaluation)
			
			logger.info(f"Generate predictions {epoch}")
			predictions = predict_estimator.predict(input_fn=predict_input_fn)
			
			logger.info(f"Save predictions")
			save_predictions(args, suffixed_folder(args, args.result_dir), eval_file, predictions, epoch, total_steps, experiment)

	logger.info(f"Completed {args.epochs} epochs") 
開發者ID:Octavian-ai,項目名稱:BigGAN-TPU-TensorFlow,代碼行數:42,代碼來源:main_loop.py

示例10: experiment

# 需要導入模塊: import comet_ml [as 別名]
# 或者: from comet_ml import Experiment [as 別名]
def experiment(self) -> CometBaseExperiment:
        r"""
        Actual Comet object. To use Comet features in your
        :class:`~pytorch_lightning.core.lightning.LightningModule` do the following.

        Example::

            self.logger.experiment.some_comet_function()

        """
        if self._experiment is not None:
            return self._experiment

        if self.mode == "online":
            if self.experiment_key is None:
                self._experiment = CometExperiment(
                    api_key=self.api_key,
                    workspace=self.workspace,
                    project_name=self.project_name,
                    **self._kwargs
                )
                self.experiment_key = self._experiment.get_key()
            else:
                self._experiment = CometExistingExperiment(
                    api_key=self.api_key,
                    workspace=self.workspace,
                    project_name=self.project_name,
                    previous_experiment=self.experiment_key,
                    **self._kwargs
                )
        else:
            self._experiment = CometOfflineExperiment(
                offline_directory=self.save_dir,
                workspace=self.workspace,
                project_name=self.project_name,
                **self._kwargs
            )

        return self._experiment 
開發者ID:PyTorchLightning,項目名稱:pytorch-lightning,代碼行數:41,代碼來源:comet.py


注:本文中的comet_ml.Experiment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。