Skip to content

Commit

Permalink
feat: allow config to be both a path to config or an already parsed d…
Browse files Browse the repository at this point in the history
…ict in build_model_from_config (#362)

* issue #361 fix
  • Loading branch information
ismaslov authored and yoptar committed Aug 10, 2018
1 parent 4728893 commit 914527d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deeppavlov.ai
7 changes: 6 additions & 1 deletion deeppavlov/core/commands/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
See the License for the specific language governing permissions and
limitations under the License.
"""

from pathlib import Path

from deeppavlov.core.commands.utils import set_deeppavlov_root, import_packages
from deeppavlov.core.common.chainer import Chainer
from deeppavlov.core.common.file import read_json
Expand All @@ -25,7 +28,9 @@
log = get_logger(__name__)


def build_model_from_config(config, mode='infer', load_trained=False, as_component=False):
def build_model_from_config(config: [str, Path, dict], mode='infer', load_trained=False, as_component=False):
if isinstance(config, (str, Path)):
config = read_json(config)
set_deeppavlov_root(config)

import_packages(config.get('metadata', {}).get('imports', []))
Expand Down

0 comments on commit 914527d

Please sign in to comment.