mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-23 19:32:23 +00:00
fix python error
This commit is contained in:
parent
8f7bd51f7a
commit
e9877850a4
2 changed files with 6 additions and 4 deletions
|
|
@ -174,6 +174,10 @@ void addObjectMethodsForTraining(py::module& m) {
|
|||
Environment& env = get_env();
|
||||
return onnxruntime::make_unique<onnxruntime::training::TrainingSession>(so, env);
|
||||
}))
|
||||
.def(py::init([]() {
|
||||
Environment& env = get_env();
|
||||
return onnxruntime::make_unique<onnxruntime::training::TrainingSession>(GetDefaultCPUSessionOptions(), env);
|
||||
}))
|
||||
.def("finalize", [](py::object) {
|
||||
#ifdef USE_HOROVOD
|
||||
training::shutdown_horovod();
|
||||
|
|
|
|||
|
|
@ -13,11 +13,9 @@ from onnxruntime.capi.session import Session, InferenceSession, IOBinding
|
|||
class TrainingSession(InferenceSession):
|
||||
def __init__(self, path_or_bytes, parameters, sess_options=None):
|
||||
if sess_options:
|
||||
self._sess = C.TrainingSession(
|
||||
sess_options, C.get_session_initializer())
|
||||
self._sess = C.TrainingSession(sess_options)
|
||||
else:
|
||||
self._sess = C.TrainingSession(
|
||||
C.get_session_initializer(), C.get_session_initializer())
|
||||
self._sess = C.TrainingSession()
|
||||
|
||||
if isinstance(path_or_bytes, str):
|
||||
self._sess.load_model(path_or_bytes, parameters)
|
||||
|
|
|
|||
Loading…
Reference in a new issue