Skip to content

Commit 691f891

Browse files
ds-hwangchanglan
authored andcommitted
Remove @nowrap in BaseEmbedding.init_states().
GitOrigin-RevId: ff83ff4
1 parent 15300d8 commit 691f891

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

axlearn/common/decoder.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,8 @@ def prefill_states(
686686
input_segment_ids = input_batch.get("input_segment_ids", None)
687687
positions = input_batch.get("positions", None)
688688

689-
emb = self.emb.init_states(batch_size=input_ids.shape[0], dtype=self.dtype())
689+
with child_context("emb_init_states", module=self.emb):
690+
emb = self.emb.init_states(batch_size=input_ids.shape[0], dtype=self.dtype())
690691
states, outputs = self._forward_for_mode(
691692
mode=ForwardMode.INIT_STATES,
692693
cached_states=dict(emb=emb, transformer_state=time_step),

axlearn/common/embedding.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from axlearn.common.base_layer import BaseLayer
1212
from axlearn.common.config import REQUIRED, InstantiableConfig, Required, config_class
1313
from axlearn.common.layers import Dropout, Embedding
14-
from axlearn.common.module import Module, Tensor, child_context, nowrap
14+
from axlearn.common.module import Module, Tensor, child_context
1515
from axlearn.common.utils import Nested, validate_contains_paths
1616

1717

@@ -50,7 +50,6 @@ def attend(self, x: Tensor):
5050
"""
5151
raise NotImplementedError(type(self))
5252

53-
@nowrap
5453
def init_states(self, *, batch_size: int, dtype: jnp.dtype) -> Nested[Tensor]:
5554
"""Initializes state for streaming decode.
5655

0 commit comments

Comments
 (0)