Python dill.load_session() Examples

The following are 5 code examples of dill.load_session(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module dill , or try the search function .
Example #1
Source File: notebook.py    From pynb with MIT License 6 votes vote down vote up
def session_load(self, hash, fname_session):
        """
        Load ipython session from file
        :param hash: cell hash
        :param fname_session: pathname to dumped session
        :return:
        """

        logging.debug('Cell {}: loading session from {}'.format(hash, fname_session))

        # 'dill.settings["recurse"] = True',
        # 'dill.settings["byref"] = True',

        inject_code = ['import dill',
                       'dill.load_session(filename="{}")'.format(fname_session),
                       ]

        inject_cell = nbf.v4.new_code_cell('\n'.join(inject_code))
        super().run_cell(inject_cell) 
Example #2
Source File: Util.py    From pyFTS with GNU General Public License v3.0 5 votes vote down vote up
def load_env(file):
    dill.load_session(file) 
Example #3
Source File: neuralnetwork.py    From neural-network-from-scratch with MIT License 5 votes vote down vote up
def predict(self, filename, input):
        dill.load_session(filename)
        self.batch_size = 1
        self.forward_pass(input)
        a = self.layers[self.num_layers-1].activations
        a[np.where(a==np.max(a))] = 1
        a[np.where(a!=np.max(a))] = 0
        return a 
Example #4
Source File: neuralnetwork.py    From neural-network-from-scratch with MIT License 5 votes vote down vote up
def check_accuracy(self, filename, inputs, labels):
        dill.load_session(filename)
        self.batch_size = len(inputs)
        self.forward_pass(inputs)
        a = self.layers[self.num_layers-1].activations
        a[np.where(a==np.max(a))] = 1
        a[np.where(a!=np.max(a))] = 0
        total=0
        correct=0
        for i in range(len(a)):
            total += 1
            if np.equal(a[i], labels[i]).all():
                correct += 1
        print("Accuracy: ", correct*100/total) 
Example #5
Source File: neuralnetwork.py    From neural-network-from-scratch with MIT License 5 votes vote down vote up
def load_model(self, filename):
        dill.load_session(filename)