use importlib instead of __import___
This commit is contained in:
parent
00d2a01bf0
commit
73c458d47b
@ -1,4 +1,5 @@
|
|||||||
import collections
|
import collections
|
||||||
|
import importlib
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
@ -573,8 +574,8 @@ class FreqaiDataDrawer:
|
|||||||
from tensorflow import keras
|
from tensorflow import keras
|
||||||
model = keras.models.load_model(dk.data_path / f"{dk.model_filename}_model.h5")
|
model = keras.models.load_model(dk.data_path / f"{dk.model_filename}_model.h5")
|
||||||
elif self.model_type == 'stable_baselines':
|
elif self.model_type == 'stable_baselines':
|
||||||
mod = __import__('stable_baselines3', fromlist=[
|
mod = importlib.import_module(
|
||||||
self.freqai_info['rl_config']['model_type']])
|
'stable_baselines3', self.freqai_info['rl_config']['model_type'])
|
||||||
MODELCLASS = getattr(mod, self.freqai_info['rl_config']['model_type'])
|
MODELCLASS = getattr(mod, self.freqai_info['rl_config']['model_type'])
|
||||||
model = MODELCLASS.load(dk.data_path / f"{dk.model_filename}_model")
|
model = MODELCLASS.load(dk.data_path / f"{dk.model_filename}_model")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user