Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinilm
Commits
fcbf7bfc
Commit
fcbf7bfc
authored
Mar 06, 2026
by
PanZezhong
Browse files
issue/248 fix reset cache
parent
471309e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
csrc/engine/infer_engine.cpp
csrc/engine/infer_engine.cpp
+1
-1
csrc/pybind11/engine/engine.hpp
csrc/pybind11/engine/engine.hpp
+3
-2
No files found.
csrc/engine/infer_engine.cpp
View file @
fcbf7bfc
...
...
@@ -175,7 +175,7 @@ void InferEngine::reset_cache(const cache::CacheConfig *new_config) {
for
(
auto
&
worker
:
workers_
)
{
worker
->
wait
();
}
cache_config_
=
new_config
->
unique_copy
();
this
->
compile
();
}
...
...
csrc/pybind11/engine/engine.hpp
View file @
fcbf7bfc
...
...
@@ -70,9 +70,10 @@ inline void bind_infer_engine(py::module &m) {
"forward"
,
[](
InferEngine
&
self
,
const
InferEngine
::
Input
&
input
)
->
InferEngine
::
Output
{
return
self
.
forward
(
input
);
},
"Run inference on all ranks with arbitrary arguments"
)
.
def
(
"reset_cache"
,
[](
InferEngine
&
self
,
std
::
shared_ptr
<
const
cache
::
CacheConfig
>
cfg
)
{
self
.
reset_cache
(
cfg
?
cfg
.
get
()
:
nullptr
);
},
py
::
arg
(
"cache_config"
)
=
py
::
none
())
.
def
(
"get_cache_config"
,
[](
const
InferEngine
&
self
)
{
.
def
(
"get_cache_config"
,
[](
const
InferEngine
&
self
)
->
std
::
shared_ptr
<
cache
::
CacheConfig
>
{
auto
cfg
=
self
.
get_cache_config
();
return
std
::
shared_ptr
<
cache
::
CacheConfig
>
(
std
::
move
(
cfg
->
unique_copy
()));
})
return
cfg
?
std
::
shared_ptr
<
cache
::
CacheConfig
>
(
cfg
->
unique_copy
())
:
nullptr
;
})
.
def
(
"__repr__"
,
[](
const
InferEngine
&
self
)
{
return
"<InferEngine: "
+
std
::
string
(
self
.
get_dist_config
())
+
">"
;
});
infer_engine
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment