问题
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
回答1:
I just found the answer:
from model import *
来源:https://stackoverflow.com/questions/43931591/how-can-i-import-from-a-module-loaded-with-imp