Download chatengine/inference/get_inference.py from peterzx/test3: direct link, hf CLI and curl.
- Browser
- Download file 795 Bytes
-
https://huggingface.co/spaces/peterzx/test3/resolve/main/chatengine/inference/get_inference.py
- Command line
-
hf download hf://spaces/peterzx/test3/chatengine/inference/get_inference.py
-
curl -L -o get_inference.py https://huggingface.co/spaces/peterzx/test3/resolve/main/chatengine/inference/get_inference.py
795 Bytes
| ''' | |
| ----------------------------------------------------------------------------- | |
| Copyright (c) 2023, ai-study-room. All rights reserved. | |
| Authors: freesky-edward | |
| This source code or documentation is under the license under the | |
| LICENSE file in the root directory of this repository | |
| ----------------------------------------------------------------------------- | |
| ''' | |
| import importlib | |
| def get_inference(cfg): | |
| r""" | |
| load the give inference base on the configuration. | |
| the default inferences locats under models directory | |
| and each model will: | |
| 1). inhirted from BaseInference | |
| 2). provide a config file under its own root directory. | |
| """ | |
| inference_lib = importlib.import_module(cfg.inference.type) | |
| inference = inference_lib.Inference(cfg) | |
| return inference | |