mirror of
https://github.com/finegrain-ai/refiners.git
synced 2024-11-21 21:58:47 +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()
|
||||
|
||||
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)
|
||||
|
||||
@property
|
||||
|
|
|
@ -62,6 +62,8 @@ class ContextModule(Module):
|
|||
return self._parent[0]
|
||||
|
||||
def _set_parent(self, parent: "Chain | None") -> None:
|
||||
if not self._can_refresh_parent:
|
||||
return
|
||||
if parent is None:
|
||||
self._parent = []
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue