mirror of
https://github.com/finegrain-ai/refiners.git
synced 2024-11-22 06:08:46 +00:00
always respect _can_refresh_parent
This commit is contained in:
parent
d389d11a06
commit
bd59790e08
|
@ -142,7 +142,7 @@ class Chain(ContextModule):
|
||||||
self._reset_context()
|
self._reset_context()
|
||||||
|
|
||||||
for module in self:
|
for module in self:
|
||||||
if isinstance(module, ContextModule) and module._can_refresh_parent and module.parent != self:
|
if isinstance(module, ContextModule) and module.parent != self:
|
||||||
module._set_parent(self)
|
module._set_parent(self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -62,6 +62,8 @@ class ContextModule(Module):
|
||||||
return self._parent[0]
|
return self._parent[0]
|
||||||
|
|
||||||
def _set_parent(self, parent: "Chain | None") -> None:
|
def _set_parent(self, parent: "Chain | None") -> None:
|
||||||
|
if not self._can_refresh_parent:
|
||||||
|
return
|
||||||
if parent is None:
|
if parent is None:
|
||||||
self._parent = []
|
self._parent = []
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue