当前位置: 首页>>代码示例>>Python>>正文


Python wandb.init方法代码示例

本文整理汇总了Python中wandb.init方法的典型用法代码示例。如果您正苦于以下问题:Python wandb.init方法的具体用法?Python wandb.init怎么用?Python wandb.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wandb的用法示例。


在下文中一共展示了wandb.init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def __init__(self):
        super(Value, self).__init__()
        self.fc1 = nn.Linear(np.array(env.observation_space.shape).prod(), 120)
        self.fc2 = nn.Linear(120, 84)
        self.fc3 = nn.Linear(84, 1)

        if args.weights_init == "orthogonal":
            torch.nn.init.orthogonal_(self.fc1.weight)
            torch.nn.init.orthogonal_(self.fc2.weight)
            torch.nn.init.orthogonal_(self.fc3.weight)
        elif args.weights_init == "xavier":
            torch.nn.init.xavier_uniform_(self.fc1.weight)
            torch.nn.init.xavier_uniform_(self.fc2.weight)
            torch.nn.init.orthogonal_(self.fc3.weight)
        else:
            raise NotImplementedError 
开发者ID:vwxyzjn,项目名称:cleanrl,代码行数:18,代码来源:ppo2.py

示例2: __init__

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def __init__(self):
        super(Policy, self).__init__()
        self.fc1 = nn.Linear(input_shape, 120)
        self.fc2 = nn.Linear(120, 84)
        self.mean = nn.Linear(84, output_shape)
        self.logstd = nn.Parameter(torch.zeros(1, output_shape))

        if args.pol_layer_norm:
            self.ln1 = torch.nn.LayerNorm(120)
            self.ln2 = torch.nn.LayerNorm(84)
        if args.weights_init == "orthogonal":
            torch.nn.init.orthogonal_(self.fc1.weight)
            torch.nn.init.orthogonal_(self.fc2.weight)
            torch.nn.init.orthogonal_(self.mean.weight)
        elif args.weights_init == "xavier":
            torch.nn.init.xavier_uniform_(self.fc1.weight)
            torch.nn.init.xavier_uniform_(self.fc2.weight)
            torch.nn.init.xavier_uniform_(self.mean.weight)
        else:
            raise NotImplementedError 
开发者ID:vwxyzjn,项目名称:cleanrl,代码行数:22,代码来源:ppo3_continuous_action.py

示例3: __init__

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def __init__(self):
        super(Policy, self).__init__()
        self.fc1 = nn.Linear(np.array(env.observation_space.shape).prod(), 120)
        self.fc2 = nn.Linear(120, 84)
        self.mean = nn.Linear(84, np.prod(env.action_space.shape))
        self.logstd = nn.Parameter(torch.zeros(1, np.prod(env.action_space.shape)))

        if args.pol_layer_norm:
            self.ln1 = torch.nn.LayerNorm(120)
            self.ln2 = torch.nn.LayerNorm(84)
        if args.weights_init == "orthogonal":
            torch.nn.init.orthogonal_(self.fc1.weight)
            torch.nn.init.orthogonal_(self.fc2.weight)
            torch.nn.init.orthogonal_(self.mean.weight)
        elif args.weights_init == "xavier":
            torch.nn.init.xavier_uniform_(self.fc1.weight)
            torch.nn.init.xavier_uniform_(self.fc2.weight)
            torch.nn.init.xavier_uniform_(self.mean.weight)
        else:
            raise NotImplementedError 
开发者ID:vwxyzjn,项目名称:cleanrl,代码行数:22,代码来源:ppo2_continuous_action.py

示例4: experiment

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def experiment(self) -> Run:
        r"""

        Actual wandb object. To use wandb features in your
        :class:`~pytorch_lightning.core.lightning.LightningModule` do the following.

        Example::

            self.logger.experiment.some_wandb_function()

        """
        if self._experiment is None:
            if self._offline:
                os.environ['WANDB_MODE'] = 'dryrun'
            self._experiment = wandb.init(
                name=self._name, dir=self._save_dir, project=self._project, anonymous=self._anonymous,
                reinit=True, id=self._id, resume='allow', tags=self._tags, entity=self._entity,
                group=self._group)
            # save checkpoints in wandb dir to upload on W&B servers
            if self._log_model:
                self.save_dir = self._experiment.dir
        return self._experiment 
开发者ID:PyTorchLightning,项目名称:pytorch-lightning,代码行数:24,代码来源:wandb.py

示例5: train_init

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def train_init(self, experiment_directory, experiment_name, model_name,
                   resume, output_directory):
        import wandb
        logger.info("wandb.train_init() called...")
        wandb.init(project=os.getenv("WANDB_PROJECT", experiment_name),
                   name=model_name, sync_tensorboard=True, dir=output_directory)
        wandb.save(os.path.join(experiment_directory, "*")) 
开发者ID:uber,项目名称:ludwig,代码行数:9,代码来源:wandb.py

示例6: __init__

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def __init__(self, hp, logdir):
        self.hp = hp
        if hp.log.use_tensorboard:
            self.tensorboard = SummaryWriter(logdir)
        if hp.log.use_wandb:
            wandb_init_conf = hp.log.wandb_init_conf.to_dict()
            wandb_init_conf["config"] = hp.to_dict()
            wandb.init(**wandb_init_conf) 
开发者ID:ryul99,项目名称:pytorch-project-template,代码行数:10,代码来源:writer.py

示例7: layer_init

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def layer_init(layer, weight_gain=1, bias_const=0):
    if isinstance(layer, nn.Linear):
        if args.weights_init == "xavier":
            torch.nn.init.xavier_uniform_(layer.weight, gain=weight_gain)
        elif args.weights_init == "orthogonal":
            torch.nn.init.orthogonal_(layer.weight, gain=weight_gain)
        if args.bias_init == "zeros":
            torch.nn.init.constant_(layer.bias, bias_const) 
开发者ID:vwxyzjn,项目名称:cleanrl,代码行数:10,代码来源:sac_continuous_action.py

示例8: layer_init

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def layer_init(layer, std=np.sqrt(2), bias_const=0.0):
    torch.nn.init.orthogonal_(layer.weight, std)
    torch.nn.init.constant_(layer.bias, bias_const)
    return layer 
开发者ID:vwxyzjn,项目名称:cleanrl,代码行数:6,代码来源:ppo.py

示例9: reset_parameters

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def reset_parameters(self):
        nn.init.constant_(self.weight, 0.0)
        if self.bias is not None:
            nn.init.constant_(self.bias, 0.0) 
开发者ID:vwxyzjn,项目名称:cleanrl,代码行数:6,代码来源:dqn_atari_visual.py

示例10: set_wandb

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def set_wandb(self):
        """Set configuration for wandb logging."""
        wandb.init(
            project=self.log_cfg.env_name,
            name=f"{self.log_cfg.agent}/{self.log_cfg.curr_time}",
        )
        wandb.config.update(vars(self.args))
        wandb.config.update(self.hyper_params)
        shutil.copy(self.args.cfg_path, os.path.join(wandb.run.dir, "config.py")) 
开发者ID:medipixel,项目名称:rl_algorithms,代码行数:11,代码来源:agent.py

示例11: set_wandb

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def set_wandb(self):
        """Set configuration for wandb logging."""
        wandb.init(
            project=self.env_info.name,
            name=f"{self.log_cfg.agent}/{self.log_cfg.curr_time}",
        )
        wandb.config.update(vars(self.args))
        shutil.copy(self.args.cfg_path, os.path.join(wandb.run.dir, "config.py")) 
开发者ID:medipixel,项目名称:rl_algorithms,代码行数:10,代码来源:distributed_logger.py

示例12: create_experiment

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def create_experiment(self):
        """Creates and returns a new experiment"""
        experiment = wandb.init(
            name=self._name, dir=self._dir, project=self._project,
            anonymous=self._anonymous, reinit=True, id=self._id,
            resume='allow', tags=self._tags, entity=self._entity
        )
        wandb.run.save()
        return experiment 
开发者ID:TRI-ML,项目名称:packnet-sfm,代码行数:11,代码来源:wandb_logger.py

示例13: neptune_experiment_cls

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def neptune_experiment_cls(self):
        import neptune
        neptune.init(project_qualified_name="tests/dry-run",
                     backend=neptune.OfflineBackend())
        return neptune.create_experiment 
开发者ID:skorch-dev,项目名称:skorch,代码行数:7,代码来源:test_logging.py

示例14: wandb_run_cls

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def wandb_run_cls(self):
        import wandb
        os.environ['WANDB_MODE'] = 'dryrun' # run offline
        with wandb.init(anonymous="allow") as run:
            return run 
开发者ID:skorch-dev,项目名称:skorch,代码行数:7,代码来源:test_logging.py

示例15: run_wandb

# 需要导入模块: import wandb [as 别名]
# 或者: from wandb import init [as 别名]
def run_wandb(entity, project, run_id, run_cls: type = Training, checkpoint_path: str = None):
  """run and save config and stats to https://wandb.com"""
  wandb_dir = mkdtemp()  # prevent wandb from polluting the home directory
  atexit.register(shutil.rmtree, wandb_dir, ignore_errors=True)  # clean up after wandb atexit handler finishes
  import wandb
  config = partial_to_dict(run_cls)
  config['seed'] = config['seed'] or randrange(1, 1000000)  # if seed == 0 replace with random
  config['environ'] = log_environment_variables()
  config['git'] = git_info()
  resume = checkpoint_path and exists(checkpoint_path)
  wandb.init(dir=wandb_dir, entity=entity, project=project, id=run_id, resume=resume, config=config)
  for stats in iterate_episodes(run_cls, checkpoint_path):
    [wandb.log(json.loads(s.to_json())) for s in stats] 
开发者ID:rmst,项目名称:rtrl,代码行数:15,代码来源:__init__.py


注:本文中的wandb.init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。