Load pickled model.
336739
def load(self, model):
        """"""
        self.perceptron.weights, self.tagdict, self.classes, self.clusters = load_model(model)
        self.perceptron.classes = self.classes
432496
def load_object(self, kwargs):
        """"""
        self.object = None
        self.config = None
        self.model = self.get_model_class()
        kwargs.pop('app', None)
        kwargs.pop('model', None)

        if self.model and kwargs.get('pk', False):
            try:
                self.object = self.model.objects.get(pk=kwargs.pop('pk'))
            except Exception:
                raise Exception("Could not load {}".format(self.model.__name__.lower()))
            setattr(self, self.model.__name__.lower(), self.object)

        return kwargs
909508
def get_model(app, model):
    """"""
    if 'get_model' not in _LAZY_LOADS:
        _lazy_load_get_model()

    _get_model = _LAZY_LOADS['get_model']
    return _get_model(app, model)
141096
def load(self, filename):
        """"""
        if filename[-6:] != ".lcopt":
            filename += ".lcopt"
        try:
            savedInstance = pickle.load(open("{}".format(filename), "rb"))
        except FileNotFoundError:
            savedInstance = pickle.load(open(fix_mac_path_escapes(os.path.join(storage.model_dir, "{}".format(filename))), "rb"))
        
        attributes = ['name',
                      'database',
                      'params',
                      'production_params',
                      'allocation_params',
                      'ext_params',
                      'matrix',
                      'names',
                      'parameter_sets',
                      'model_matrices',
                      'technosphere_matrices',
                      'leontif_matrices',
                      'external_databases',
                      'parameter_map',
                      'sandbox_positions',
                      'ecoinventName',
                      'biosphereName',
                      'forwastName',
                      'analysis_settings',
                      'technosphere_databases',
                      'biosphere_databases',
                      'result_set',
                      'evaluated_parameter_sets',
                      'useForwast',
                      'base_project_name',
                      'save_option',
                      'allow_allocation',
                      'ecoinvent_version',
                      'ecoinvent_system_model',
                      ]

        for attr in attributes:

            if hasattr(savedInstance, attr):
                setattr(self, attr, getattr(savedInstance, attr))
            else:
                pass
                #print ("can't set {}".format(attr))

        # use legacy save option if this is missing from the model
        if not hasattr(savedInstance, 'save_option'):
            setattr(self, 'save_option', LEGACY_SAVE_OPTION)

        # figure out ecoinvent version and system model if these are missing from the model
        if not hasattr(savedInstance, 'ecoinvent_version') or not hasattr(savedInstance, 'ecoinvent_system_model'):
            
            parts = savedInstance.ecoinventName.split("_")
            main_version = parts[0][-1]
            sub_version = parts[1]
            system_model = parts[2]

            #print(parts)

            setattr(self, 'ecoinvent_version', '{}.{}'.format(main_version, sub_version))
            setattr(self, 'ecoinvent_system_model', system_model)
878097
def load_raw(cls, model_fn, schema, *args, **kwargs):
        
        c = cls(*args, **kwargs)
        c.schema = schema.copy(schema_only=True)
        c._model_data = open(model_fn, 'rb').read()
        return c
1065638
def load(self):
        
        try:
            with open(self.file_root + '.pkl', "rb") as f:
                return pickle.load(f)
        except IOError:
            raise CacheMissing(self.file_root)
740485
def load(self, path):
        """"""
        with io.open(path, 'rb') as fin:
            self.weights = pickle.load(fin)
292687
def load(self, fp):
        """"""
        cluster = pickle.load(fp)
        cluster.repository = self
        return cluster
1060029
def load(path):
  """"""
  proto = _parse_saved_model(path)
  _merge_assets_key_collection(proto, path)
  handler = SavedModelHandler()
  handler._proto = proto  # pylint: disable=protected-access
  return handler
1362237
def pickle_load(fname):
    """"""
    assert type(fname) is str and os.path.exists(fname)
    print("loaded",fname)
    return pickle.load(open(fname,"rb"))
303621
def load_tree_object(filename):
    
    with open(filename) as file_obj:
        tree_ensemble_obj = pickle.load(file_obj)
    return tree_ensemble_obj
820519
def __load(self, path):
        """"""
        try:
            path = os.path.abspath(path)
            with open(path, 'rb') as df:
                # loaded_dataset = pickle.load(df)
                self.__data, self.__classes, self.__labels, \
                self.__dtype, self.__description, \
                self.__num_features, self.__feature_names = pickle.load(df)

            # ensure the loaded dataset is valid
            self.__validate(self.__data, self.__classes, self.__labels)

        except IOError as ioe:
            raise IOError('Unable to read the dataset from file: {}', format(ioe))
        except:
            raise
873809
def loads(s, model=None, parser=None):
    """"""
    with StringIO(s) as f:
        return load(f, model=model, parser=parser)
936406
def save_model(model, output_file):
    """"""
    if not output_file:
        return

    with open(output_file, 'wb') as f:
        pickle.dump(model, f)
    print("Saved model to file '{}'.".format(output_file))
541717
def load_for(self, model: str) -> Tuple[list, list]:
        """"""
        inject_params(model)
        if self.prev_cache != pr.vectorization_md5_hash():
            self.prev_cache = pr.vectorization_md5_hash()
            self.data = self.loader()
        return self.data
252223
def save_ldamodel_to_pickle(picklefile, model, vocab, doc_labels, dtm=None, **kwargs):
    """"""
    pickle_data({'model': model, 'vocab': vocab, 'doc_labels': doc_labels, 'dtm': dtm}, picklefile)
46603
def from_pickle(cls, filename):
        """"""
        with open(filename, 'rb') as f:
            cam = pickle.load(f)

        projection = cam.projection.copy()
        return cls(projection=projection, position=cam.position.xyz, rotation=cam.rotation.__class__(*cam.rotation[:]))