Loads the model from checkpoint specified by prefix and epoch, binds it
    to an executor, and sets its parameters and returns a mx.mod.Module
165548
def load_module(prefix, epoch, data_names, data_shapes):
    
    sym, arg_params, aux_params = mx.model.load_checkpoint(prefix, epoch)

    # We don't need CTC loss for prediction, just a simple softmax will suffice.
    # We get the output of the layer just before the loss layer ('pred_fc') and add softmax on top
    pred_fc = sym.get_internals()['pred_fc_output']
    sym = mx.sym.softmax(data=pred_fc)

    mod = mx.mod.Module(symbol=sym, context=mx.cpu(), data_names=data_names, label_names=None)
    mod.bind(for_training=False, data_shapes=data_shapes)
    mod.set_params(arg_params, aux_params, allow_missing=False)
    return mod
269476
def call(env)
      context = { request: ActionDispatch::Request.new(env) }
      sequence = build_sequence(@root_item, context)
      chain = build_request_chain(sequence, context)

      event = build_event(context)

      publish_start(event.dup)
      instrumented_call(event) do
        begin
          response = chain.instrument.call
        ensure
          # We want to populate the response and metadata fields after the middleware
          # chain has completed so that the end of the instrumentation can see them. The
          # simplest way to do this is pass the event by reference to ActiveSupport, then
          # modify the hash to contain this detail before the instrumentation completes.
          #
          # This way, the last finish_handler.coach event will have all the details.
          status = response.try(:first) || STATUS_CODE_FOR_EXCEPTIONS
          event.merge!(
            response: { status: status },
            metadata: context.fetch(:_metadata, {}),
          )
        end
      end
    end
753333
def load_module(self, module_name, path=None):
        ''''''
        self.ensure_started()
        if path is None:
            path = sys.path
        mod = self.client.call(_load_module, module_name, path)
        mod.__isolation_context__ = self
        return mod
738741
def load_module(self, mod):
        
        try:
            return sys.modules[mod]
        except KeyError:
            pass

        lib = ExtensionImporter.extension_modules[mod]
        m = imp.load_dynamic(mod, lib)
        sys.modules[mod] = m
        return m
1297917
def load_module(self, module):
        '''
        
        '''
        m_ref = self._modules_map.get(module)
        if m_ref is None:
            raise LoaderError('Module "{0}" was not found'.format(module))
        mod = importlib.import_module('ansible.modules{0}'.format(
            '.'.join([elm.split('.')[0] for elm in m_ref.split(os.path.sep)])))

        return mod
977406
def main():
    
    log = logging.getLogger(mod_logger + '.main')
    parser = argparse.ArgumentParser(description='This Python module retrieves artifacts from Nexus.')
    parser.add_argument('-u', '--url', help='Nexus Server URL', required=False)
    parser.add_argument('-g', '--groupId', help='Group ID', required=True)
    parser.add_argument('-a', '--artifactId', help='Artifact ID', required=True)
    parser.add_argument('-v', '--version', help='Artifact Version', required=True)
    parser.add_argument('-c', '--classifier', help='Artifact Classifier', required=False)
    parser.add_argument('-p', '--packaging', help='Artifact Packaging', required=True)
    parser.add_argument('-r', '--repo', help='Nexus repository name', required=False)
    parser.add_argument('-d', '--destinationDir', help='Directory to download to', required=True)
    parser.add_argument('-n', '--username', help='Directory to download to', required=True)
    parser.add_argument('-w', '--password', help='Directory to download to', required=True)
    args = parser.parse_args()
    try:
        get_artifact(
            nexus_url=args.url,
            group_id=args.groupId,
            artifact_id=args.artifactId,
            version=args.version,
            classifier=args.classifier,
            packaging=args.packaging,
            repo=args.repo,
            destination_dir=args.destinationDir,
            username=args.username,
            password=args.password
        )
    except Exception as e:
        msg = 'Caught exception {n}, unable for download artifact from Nexus\n{s}'.format(
            n=e.__class__.__name__, s=e)
        log.error(msg)
        return
1360164
def load(self, filename):
        
        if os.path.isfile(filename):
            checkpoint = torch.load(filename, map_location={'cuda:0': 'cpu'})
            if self.distributed:
                self.model.module.load_state_dict(checkpoint['state_dict'])
            else:
                self.model.load_state_dict(checkpoint['state_dict'])
            self.fp_optimizer.initialize_model(self.model)
            self.optimizer.load_state_dict(checkpoint['optimizer'])
            self.scheduler.load_state_dict(checkpoint['scheduler'])
            self.epoch = checkpoint['epoch']
            self.loss = checkpoint['loss']
            logging.info(f'Loaded checkpoint {filename} (epoch {self.epoch})')
        else:
            logging.error(f'Invalid checkpoint: {filename}')
288919
def load(config_path, run_number=0, device='cuda:0'):
    
    model_config = ModelConfig.from_file(config_path, run_number, device=device)

    return model_config
157908
def load(self, model):
        
        self.load_medium(model)
        self.load_essentiality(model)
        self.load_growth(model)
        # self.load_experiment(config.config.get("growth"), model)
        return self
1299913
def _load_prefix_binding(self):
        
        pymux = self.pymux

        # Remove previous binding.
        if self._prefix_binding:
            self.custom_key_bindings.remove_binding(self._prefix_binding)

        # Create new Python binding.
        @self.custom_key_bindings.add(*self._prefix, filter=
            ~(HasPrefix(pymux) | has_focus(COMMAND) | has_focus(PROMPT) |
              WaitsForConfirmation(pymux)))
        def enter_prefix_handler(event):
            " Enter prefix mode. "
            pymux.get_client_state().has_prefix = True

        self._prefix_binding = enter_prefix_handler
936859
def _load_from_yaml(self, filename: str, model_identifiers: Dict[str, List[str]]):
        
        class_name = filename[:filename.rfind('.')]
        rendered_yaml = self.env.get_template(filename).render(
            model_identifiers=model_identifiers)
        fixture_data, self.relationships[class_name] = self._post_process_yaml_data(
            yaml.load(rendered_yaml),
            self.factory.get_relationships(class_name))

        for identifier_key, data in fixture_data.items():
            self.model_fixtures[class_name][identifier_key] = data
913118
def load_model_from_package(name, **overrides):
    """"""
    cls = importlib.import_module(name)
    return cls.load(**overrides)
638930
def load(obj, settings_module, identifier="py", silent=False, key=None):
    """"""
    mod, loaded_from = get_module(obj, settings_module, silent)

    if mod and loaded_from:
        obj.logger.debug("py_loader: {}".format(mod))
    else:
        obj.logger.debug(
            "py_loader: %s (Ignoring, Not Found)", settings_module
        )
        return

    for setting in dir(mod):
        if setting.isupper():
            if key is None or key == setting:
                setting_value = getattr(mod, setting)
                obj.logger.debug(
                    "py_loader: loading %s: %s (%s)",
                    setting,
                    "*****" if "secret" in settings_module else setting_value,
                    identifier,
                )
                obj.set(setting, setting_value, loader_identifier=identifier)

    obj._loaded_files.append(mod.__file__)
411874
def load_fixtures(db, fixtures):
    
    conn = db.engine.connect()
    metadata = db.metadata

    for fixture in fixtures:
        if 'model' in fixture:
            module_name, class_name = fixture['model'].rsplit('.', 1)
            module = importlib.import_module(module_name)
            model = getattr(module, class_name)
            for fields in fixture['records']:
                obj = model(**fields)
                db.session.add(obj)
            db.session.commit()
        elif 'table' in fixture:
            table = Table(fixture['table'], metadata)
            conn.execute(table.insert(), fixture['records'])
        else:
            raise ValueError("Fixture missing a 'model' or 'table' field: {0}".format(json.dumps(fixture)))
370161
def cp(source, bucket, checksum, key_prefix):
    """"""
    from .models import Bucket
    from .helpers import populate_from_path
    for object_version in populate_from_path(
            Bucket.get(bucket), source, checksum=checksum,
            key_prefix=key_prefix):
        click.secho(str(object_version))
    db.session.commit()
6203
def post_execute(self):
        
        newly_loaded_modules = set(sys.modules) - self.loaded_modules
        for modname in newly_loaded_modules:
            _, pymtime = self._reloader.filename_and_mtime(sys.modules[modname])
            if pymtime is not None:
                self._reloader.modules_mtimes[modname] = pymtime

        self.loaded_modules.update(newly_loaded_modules)
929485
def cache_model(key_params, timeout='default'):
    
    def decorator_fn(fn):
        return CacheModelDecorator().decorate(key_params, timeout, fn)

    return decorator_fn