3

I currently work with keras and custom activation functions. I store those models as pickle and I would like to be able to load them again. Then I run into this issue.

The problem is that the Python script which contains the custom activation function is given by path. I load this script via

import imp
model_module = imp.load_source('model', experiment_meta['model']['script_path'])

How can I "star import" (import *) in this case to make the loading of the trained model work?

What I've tried

from model_module import *

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named model_module
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958

1 Answers1

0

I just found the answer:

from model import *
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
  • In case you want to use this for keras, see [How do you create a custom activation function with Keras?](http://stackoverflow.com/a/43915483/562769) – Martin Thoma May 12 '17 at 08:14