Esempio n. 1
0
    def distributed(self, rank: int, world_size: int):
        self.distributed_rank = rank
        self.distributed_world_size = world_size

        if self.distributed_rank != 0:
            monitor().silent()

        # to make sure we have the path to save pid
        self.run.make_path()
Esempio n. 2
0
def create(*,
           uuid: Optional[str] = None,
           name: Optional[str] = None,
           python_file: Optional[str] = None,
           comment: Optional[str] = None,
           writers: Set[str] = None,
           ignore_callers: Set[str] = None,
           tags: Optional[Set[str]] = None,
           disable_screen: bool = False):
    r"""
    Create an experiment

    Keyword Arguments:
        name (str, optional): name of the experiment
        python_file (str, optional): path of the Python file that
            created the experiment
        comment (str, optional): a short description of the experiment
        writers (Set[str], optional): list of writers to write stat to.
            Defaults to ``{'tensorboard', 'sqlite', 'web_api'}``.
        ignore_callers: (Set[str], optional): list of files to ignore when
            automatically determining ``python_file``
        tags (Set[str], optional): Set of tags for experiment
    """

    if writers is None:
        writers = {'screen', 'sqlite', 'web_api'}
        from labml.internal.util.tensorboard_writer import has_tensorboard
        if has_tensorboard():
            writers.add('tensorboard')

    for w in writers:
        if w not in AVAILABLE_WRITERS:
            raise ValueError(f'Unknown writer: {w}')

    if disable_screen and 'screen' in writers:
        writers.remove('screen')

    if ignore_callers is None:
        ignore_callers = set()

    if uuid is None:
        uuid = generate_uuid()

    monitor().clear()

    _create_experiment(uuid=uuid,
                       name=name,
                       python_file=python_file,
                       comment=comment,
                       writers=writers,
                       ignore_callers=ignore_callers,
                       tags=tags,
                       is_evaluate=False)
Esempio n. 3
0
def evaluate():
    r"""
    This should be used for evaluation of a saved experiment.
    This will not record anything.
    """

    monitor().clear()
    _create_experiment(uuid=generate_uuid(),
                       name=None,
                       python_file=None,
                       comment=None,
                       writers=set(),
                       ignore_callers=set(),
                       tags=None,
                       is_evaluate=True)