start tensorboard
324802
def start_tensorboard(args):
    ''''''
    experiment_id = check_experiment_id(args)
    experiment_config = Experiments()
    experiment_dict = experiment_config.get_all_experiments()
    config_file_name = experiment_dict[experiment_id]['fileName']
    nni_config = Config(config_file_name)
    rest_port = nni_config.get_config('restServerPort')
    rest_pid = nni_config.get_config('restServerPid')
    if not detect_process(rest_pid):
        print_error('Experiment is not running...')
        return
    running, response = check_rest_server_quick(rest_port)
    trial_content = None
    if running:
        response = rest_get(trial_jobs_url(rest_port), REST_TIME_OUT)
        if response and check_response(response):
            trial_content = json.loads(response.text)
        else:
            print_error('List trial failed...')
    else:
        print_error('Restful server is not running...')
    if not trial_content:
        print_error('No trial information!')
        exit(1)
    if len(trial_content) > 1 and not args.trial_id:
        print_error('There are multiple trials, please set trial id!')
        exit(1)
    experiment_id = nni_config.get_config('experimentId')
    temp_nni_path = os.path.join(tempfile.gettempdir(), 'nni', experiment_id)
    os.makedirs(temp_nni_path, exist_ok=True)

    path_list = get_path_list(args, nni_config, trial_content, temp_nni_path)
    start_tensorboard_process(args, nni_config, path_list, temp_nni_path)
829280
def open_session(self):
        
        with self._graph.as_default():
            init = tf.initialize_all_variables()
            self._sess = tf.Session()
            self._sess.run(init)
213176
def start(self):
        '''
        
        '''
        super(Minion, self).start()
        while True:
            try:
                self._real_start()
            except SaltClientError as exc:
                # Restart for multi_master failover when daemonized
                if self.options.daemon:
                    continue
            break
1197085
def start(self):
        # type: (SyncCopy) -> None
        
        try:
            blobxfer.operations.progress.output_parameters(
                self._general_options, self._spec)
            self._run()
        except (KeyboardInterrupt, Exception) as ex:
            if isinstance(ex, KeyboardInterrupt):
                logger.info(
                    'KeyboardInterrupt detected, force terminating '
                    'processes and threads (this may take a while)...')
            else:
                logger.exception(ex)
            self._wait_for_transfer_threads(terminate=True)
        finally:
            # close resume file
            if self._resume is not None:
                self._resume.close()
755680
public void start() {
                // Log.d("EglHelper" + instanceId, "start()");
                if (mEgl == null) {
                        // Log.d("EglHelper" + instanceId, "getting new EGL");
                        /*
                         * Get an EGL instance
                         */
                        mEgl = (EGL10) EGLContext.getEGL();
                } else {
                        // Log.d("EglHelper" + instanceId, "reusing EGL");
                }

                if (mEglDisplay == null) {
                        // Log.d("EglHelper" + instanceId, "getting new display");
                        /*
                         * Get to the default display.
                         */
                        mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
                } else {
                        // Log.d("EglHelper" + instanceId, "reusing display");
                }

                if (mEglConfig == null) {
                        // Log.d("EglHelper" + instanceId, "getting new config");
                        /*
                         * We can now initialize EGL for that display
                         */
                        int[] version = new int[2];
                        mEgl.eglInitialize(mEglDisplay, version);
                        mEglConfig = mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);
                } else {
                        // Log.d("EglHelper" + instanceId, "reusing config");
                }

                if (mEglContext == null) {
                        // Log.d("EglHelper" + instanceId, "creating new context");
                        /*
                         * Create an OpenGL ES context. This must be done only once, an OpenGL context is a somewhat heavy object.
                         */
                        mEglContext = mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
                        if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
                                throw new RuntimeException("createContext failed");
                        }
                } else {
                        // Log.d("EglHelper" + instanceId, "reusing context");
                }

                mEglSurface = null;
        }
430671
def main():
    """"""
    # Initialization variables - update to change your model and execution context
    model_prefix = "FCN8s_VGG16"
    epoch = 19

    # By default, MXNet will run on the CPU. Change to ctx = mx.gpu() to run on GPU.
    ctx = mx.cpu()

    fcnxs, fcnxs_args, fcnxs_auxs = mx.model.load_checkpoint(model_prefix, epoch)
    fcnxs_args["data"] = mx.nd.array(get_data(args.input), ctx)
    data_shape = fcnxs_args["data"].shape
    label_shape = (1, data_shape[2]*data_shape[3])
    fcnxs_args["softmax_label"] = mx.nd.empty(label_shape, ctx)
    exector = fcnxs.bind(ctx, fcnxs_args, args_grad=None, grad_req="null", aux_states=fcnxs_args)
    exector.forward(is_train=False)
    output = exector.outputs[0]
    out_img = np.uint8(np.squeeze(output.asnumpy().argmax(axis=1)))
    out_img = Image.fromarray(out_img)
    out_img.putpalette(get_palette())
    out_img.save(args.output)
947885
def stop_tensorboard(args):
    ''''''
    experiment_id = check_experiment_id(args)
    experiment_config = Experiments()
    experiment_dict = experiment_config.get_all_experiments()
    config_file_name = experiment_dict[experiment_id]['fileName']
    nni_config = Config(config_file_name)
    tensorboard_pid_list = nni_config.get_config('tensorboardPidList')
    if tensorboard_pid_list:
        for tensorboard_pid in tensorboard_pid_list:
            try:
                cmds = ['kill', '-9', str(tensorboard_pid)]
                call(cmds)
            except Exception as exception:
                print_error(exception)
        nni_config.set_config('tensorboardPidList', [])
        print_normal('Stop tensorboard success!')
    else:
        print_error('No tensorboard configuration!')
613845
def start_chart(self):
        """"""
        self.current_dataset_name = self.chart_name
        self.datafile.init_data(self.current_dataset_name, mode='continuous')
        self.chart_name = increment_title(self.chart_name)
        
        # stimulus tracker channel hard-coded at least chan for now
        self.player.start_continuous([self.aichan, u"PCI-6259/ai31"])
216904
def start_batch_learning(self):
        """"""
        self._learning = True

        self.graph.cursor().execute("PRAGMA journal_mode=memory")
        self.graph.drop_reply_indexes()
444165
def start(grains=False, grain_keys=None, pillar=False, pillar_keys=None):
    '''
    
    '''
    state = salt.thorium.ThorState(
            __opts__,
            grains,
            grain_keys,
            pillar,
            pillar_keys)
    state.start_runtime()
1060845
def _start(self):
        """"""
        assert self._tempdir is not None
        assert self._process is None
        self._process = subprocess.Popen(
            [
                self.paths.slapd,
                '-f', self._slapd_conf,
                '-h', self.uri,
                '-d', str(self.slapd_debug),
            ],
            stdout=sys.stdout,
            stderr=sys.stderr,
        )
        self._poll_slapd(timeout=self.max_server_startup_delay)
691115
def _eval_summary(self, context: MonitorContext, feed_dict: Optional[Dict]=None) -> None:
        

        if self._summary is None:
            raise RuntimeError('TensorBoard monitor task should set the Tensorflow.Summary object')

        if context.session is None:
            raise RuntimeError('To run a TensorBoard monitor task the TF session object'
                               ' must be provided when creating an instance of the Monitor')

        summary = context.session.run(self._summary, feed_dict=feed_dict)
        self._file_writer.add_summary(summary, context.global_step)
        if self._flush_immediately:
            self.flush()
717789
def define_flags(self, parser):
    """"""
    parser.add_argument(
        '--logdir',
        metavar='PATH',
        type=str,
        default='',
        help='''\
Directory where TensorBoard will look to find TensorFlow event files
that it can display. TensorBoard will recursively walk the directory
structure rooted at logdir, looking for .*tfevents.* files.

You may also pass a comma separated list of log directories, and
TensorBoard will watch each directory. You can also assign names to
individual log directories by putting a colon between the name and the
path, as in:

`tensorboard --logdir=name1:/path/to/logs/1,name2:/path/to/logs/2`\
''')

    parser.add_argument(
        '--host',
        metavar='ADDR',
        type=str,
        default='',
        help='''\
What host to listen to. Defaults to serving on all interfaces. Other
commonly used values are 127.0.0.1 (localhost) and :: (for IPv6).\
''')

    parser.add_argument(
        '--port',
        metavar='PORT',
        type=lambda s: (None if s == "default" else int(s)),
        default="default",
        help='''\
Port to serve TensorBoard on. Pass 0 to request an unused port selected
by the operating system, or pass "default" to try to bind to the default
port (%s) but search for a nearby free port if the default port is
unavailable. (default: "default").\
''' % DEFAULT_PORT)

    parser.add_argument(
        '--purge_orphaned_data',
        metavar='BOOL',
        # Custom str-to-bool converter since regular bool() doesn't work.
        type=lambda v: {'true': True, 'false': False}.get(v.lower(), v),
        choices=[True, False],
        default=True,
        help='''\
Whether to purge data that may have been orphaned due to TensorBoard
restarts. Setting --purge_orphaned_data=False can be used to debug data
disappearance. (default: %(default)s)\
''')

    parser.add_argument(
        '--reload_interval',
        metavar='SECONDS',
        type=float,
        default=5.0,
        help='''\
How often the backend should load more data, in seconds. Set to 0 to
load just once at startup and a negative number to never reload at all.
Not relevant for DB read-only mode. (default: %(default)s)\
''')

    parser.add_argument(
        '--db',
        metavar='URI',
        type=str,
        default='',
        help='''\
[experimental] sets SQL database URI and enables DB backend mode, which is
read-only unless --db_import is also passed.\
''')

    parser.add_argument(
        '--db_import',
        action='store_true',
        help='''\
[experimental] enables DB read-and-import mode, which in combination with
--logdir imports event files into a DB backend on the fly. The backing DB is
temporary unless --db is also passed to specify a DB path to use.\
''')

    parser.add_argument(
        '--db_import_use_op',
        action='store_true',
        help='''\
[experimental] in combination with --db_import, if passed, use TensorFlow's
import_event() op for importing event data, otherwise use TensorBoard's own
sqlite ingestion logic.\
''')

    parser.add_argument(
        '--inspect',
        action='store_true',
        help='''\
Prints digests of event files to command line.

This is useful when no data is shown on TensorBoard, or the data shown
looks weird.

Must specify one of `logdir` or `event_file` flag.

Example usage:
  `tensorboard --inspect --logdir mylogdir --tag loss`

See tensorboard/backend/event_processing/event_file_inspector.py for more info.\
''')

    # This flag has a "_tb" suffix to avoid conflicting with an internal flag
    # named --version.  Note that due to argparse auto-expansion of unambiguous
    # flag prefixes, you can still invoke this as `tensorboard --version`.
    parser.add_argument(
        '--version_tb',
        action='store_true',
        help='Prints the version of Tensorboard')

    parser.add_argument(
        '--tag',
        metavar='TAG',
        type=str,
        default='',
        help='tag to query for; used with --inspect')

    parser.add_argument(
        '--event_file',
        metavar='PATH',
        type=str,
        default='',
        help='''\
The particular event file to query for. Only used if --inspect is
present and --logdir is not specified.\
''')

    parser.add_argument(
        '--path_prefix',
        metavar='PATH',
        type=str,
        default='',
        help='''\
An optional, relative prefix to the path, e.g. "/path/to/tensorboard".
resulting in the new base url being located at
localhost:6006/path/to/tensorboard under default settings. A leading
slash is required when specifying the path_prefix, however trailing
slashes can be omitted. The path_prefix can be leveraged for path based
routing of an elb when the website base_url is not available e.g.
"example.site.com/path/to/tensorboard/".\
''')

    parser.add_argument(
        '--window_title',
        metavar='TEXT',
        type=str,
        default='',
        help='changes title of browser window')

    parser.add_argument(
        '--max_reload_threads',
        metavar='COUNT',
        type=int,
        default=1,
        help='''\
The max number of threads that TensorBoard can use to reload runs. Not
relevant for db read-only mode. Each thread reloads one run at a time.
(default: %(default)s)\
''')

    parser.add_argument(
        '--reload_task',
        metavar='TYPE',
        type=str,
        default='auto',
        choices=['auto', 'thread', 'process', 'blocking'],
        help='''\
[experimental] The mechanism to use for the background data reload task.
The default "auto" option will conditionally use threads for legacy reloading
and a child process for DB import reloading. The "process" option is only
useful with DB import mode. The "blocking" option will block startup until
reload finishes, and requires --load_interval=0. (default: %(default)s)\
''')

    parser.add_argument(
        '--samples_per_plugin',
        type=str,
        default='',
        help='''\
An optional comma separated list of plugin_name=num_samples pairs to
explicitly specify how many samples to keep per tag for that plugin. For
unspecified plugins, TensorBoard randomly downsamples logged summaries
to reasonable values to prevent out-of-memory errors for long running
jobs. This flag allows fine control over that downsampling. Note that 0
means keep all samples of that type. For instance "scalars=500,images=0"
keeps 500 scalars and all images. Most users should not need to set this
flag.\
''')
899836
def main():
    
    args = parse_args()
    utils.set_device(args.cuda, args.local_rank)
    utils.init_distributed(args.cuda)
    setup_logging()

    if args.env:
        utils.log_env_info()

    logging.info(f'Run arguments: {args}')

    if not args.cuda and torch.cuda.is_available():
        warnings.warn('cuda is available but not enabled')
    if not args.cudnn:
        torch.backends.cudnn.enabled = False

    # load checkpoint and deserialize to CPU (to save GPU memory)
    checkpoint = torch.load(args.model, map_location={'cuda:0': 'cpu'})

    # build GNMT model
    tokenizer = Tokenizer()
    tokenizer.set_state(checkpoint['tokenizer'])
    vocab_size = tokenizer.vocab_size
    model_config = checkpoint['model_config']
    model_config['batch_first'] = args.batch_first
    model = GNMT(vocab_size=vocab_size, **model_config)
    model.load_state_dict(checkpoint['state_dict'])

    for (math, batch_size, beam_size) in product(args.math, args.batch_size,
                                                 args.beam_size):
        logging.info(f'math: {math}, batch size: {batch_size}, '
                     f'beam size: {beam_size}')
        if math == 'fp32':
            dtype = torch.FloatTensor
        if math == 'fp16':
            dtype = torch.HalfTensor
        model.type(dtype)

        if args.cuda:
            model = model.cuda()
        model.eval()

        # construct the dataset
        test_data = TextDataset(src_fname=args.input,
                                tokenizer=tokenizer,
                                sort=args.sort)

        # build the data loader
        test_loader = test_data.get_loader(batch_size=batch_size,
                                           batch_first=args.batch_first,
                                           shuffle=False,
                                           pad=True,
                                           num_workers=0)

        # build the translator object
        translator = Translator(model=model,
                                tokenizer=tokenizer,
                                loader=test_loader,
                                beam_size=beam_size,
                                max_seq_len=args.max_seq_len,
                                len_norm_factor=args.len_norm_factor,
                                len_norm_const=args.len_norm_const,
                                cov_penalty_factor=args.cov_penalty_factor,
                                cuda=args.cuda,
                                print_freq=args.print_freq,
                                dataset_dir=args.dataset_dir)

        # execute the inference
        translator.run(calc_bleu=args.bleu, eval_path=args.output,
                       reference_path=args.reference, summary=True)
608686
def task(ft):
	
	ft.pack(expand = True,  fill = BOTH,  side = TOP)
	pb_hD = ttk.Progressbar(ft, orient = 'horizontal', mode = 'indeterminate')
	pb_hD.pack(expand = True, fill = BOTH, side = TOP)
	pb_hD.start(50)
	ft.mainloop()
936631
public void start()
    {
        if (mAnimations.size() == 0)
        {
            return;
        }
        mIsRunning = true;
        for (GVRAnimation anim : mAnimations)
        {
            anim.start(getGVRContext().getAnimationEngine());
        }
    }
552436
def main(unused_argv):
  """"""
  tf.logging.set_verbosity(tf.logging.INFO)

  make_dir(FLAGS.raw_dir)
  make_dir(FLAGS.data_dir)

  # Get paths of download/extracted training and evaluation files.
  tf.logging.info("Step 1/4: Downloading data from source")
  train_files = get_raw_files(FLAGS.raw_dir, _TRAIN_DATA_SOURCES)
  eval_files = get_raw_files(FLAGS.raw_dir, _EVAL_DATA_SOURCES)

  # Create subtokenizer based on the training files.
  tf.logging.info("Step 2/4: Creating subtokenizer and building vocabulary")
  train_files_flat = train_files["inputs"] + train_files["targets"]
  vocab_file = os.path.join(FLAGS.data_dir, VOCAB_FILE)
  subtokenizer = tokenizer.Subtokenizer.init_from_files(
      vocab_file, train_files_flat, _TARGET_VOCAB_SIZE, _TARGET_THRESHOLD,
      min_count=None if FLAGS.search else _TRAIN_DATA_MIN_COUNT)

  tf.logging.info("Step 3/4: Compiling training and evaluation data")
  compiled_train_files = compile_files(FLAGS.raw_dir, train_files, _TRAIN_TAG)
  compiled_eval_files = compile_files(FLAGS.raw_dir, eval_files, _EVAL_TAG)

  # Tokenize and save data as Examples in the TFRecord format.
  tf.logging.info("Step 4/4: Preprocessing and saving data")
  train_tfrecord_files = encode_and_save_files(
      subtokenizer, FLAGS.data_dir, compiled_train_files, _TRAIN_TAG,
      _TRAIN_SHARDS)
  encode_and_save_files(
      subtokenizer, FLAGS.data_dir, compiled_eval_files, _EVAL_TAG,
      _EVAL_SHARDS)

  for fname in train_tfrecord_files:
    shuffle_records(fname)