def save(self, path):
    'Save model to a pickle located at `path`'
    with tempfile.TemporaryDirectory() as td:
        U.save_state(os.path.join(td, 'model'))
        arc_name = os.path.join(td, 'packed.zip')
        with zipfile.ZipFile(arc_name, 'w') as zipf:
            for (root, dirs, files) in os.walk(td):
                for fname in files:
                    file_path = os.path.join(root, fname)
                    if (file_path != arc_name):
                        zipf.write(file_path, os.path.relpath(file_path, td))
        with open(arc_name, 'rb') as f:
            model_data = f.read()
    with open(path, 'wb') as f:
        dill.dump((model_data, self._act_params), f)
Save model to a pickle located at `path`
def save(self, path):
    
    with tempfile.TemporaryDirectory() as td:
        U.save_state(os.path.join(td, 'model'))
        arc_name = os.path.join(td, 'packed.zip')
        with zipfile.ZipFile(arc_name, 'w') as zipf:
            for (root, dirs, files) in os.walk(td):
                for fname in files:
                    file_path = os.path.join(root, fname)
                    if (file_path != arc_name):
                        zipf.write(file_path, os.path.relpath(file_path, td))
        with open(arc_name, 'rb') as f:
            model_data = f.read()
    with open(path, 'wb') as f:
        dill.dump((model_data, self._act_params), f)