> This page is for version 0.5.0 · 26.06.
> For other versions, use one of these documentation indexes:
> - Nightly (default): https://docs.nvidia.com/nemo/automodel/nightly/llms.txt
> - Latest: https://docs.nvidia.com/nemo/automodel/latest/llms.txt
> - 0.7.0 · 26.10: https://docs.nvidia.com/nemo/automodel/v0.7/llms.txt
> - 0.5.0 · 26.06: https://docs.nvidia.com/nemo/automodel/v0.5/llms.txt
> - 0.4.0 · 26.04: https://docs.nvidia.com/nemo/automodel/v0.4/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/automodel/llms.txt.

# nemo_automodel.components.speculative.dflash.cached_target

Load only the frozen token tables used by cached DFlash training.

## Module Contents

### Classes

| Name                                                                                                               | Description                                                |
| ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------- |
| [`DFlashTargetTables`](#nemo_automodel-components-speculative-dflash-cached_target-DFlashTargetTables)             | Target token embedding and output projection, both frozen. |
| [`DFlashTargetTablesConfig`](#nemo_automodel-components-speculative-dflash-cached_target-DFlashTargetTablesConfig) | Checkpoint keys for the two target tables read by DFlash.  |

### Functions

| Name                                                                                         | Description |
| -------------------------------------------------------------------------------------------- | ----------- |
| [`_read_weights`](#nemo_automodel-components-speculative-dflash-cached_target-_read_weights) | -           |

### API

```python
class nemo_automodel.components.speculative.dflash.cached_target.DFlashTargetTables(
    embed_tokens: torch.nn.Embedding,
    lm_head: torch.nn.Linear
)
```

Dataclass

Target token embedding and output projection, both frozen.

**`embed_tokens`** `Embedding`

---

**`lm_head`** `Linear`

---

```python
class nemo_automodel.components.speculative.dflash.cached_target.DFlashTargetTablesConfig(
    embedding_key: str = 'model.embed_tokens.weight',
    lm_head_key: str = 'lm_head.weight'
)
```

Dataclass

Checkpoint keys for the two target tables read by DFlash.

**`embedding_key`** `str = 'model.embed_tokens.weight'`

---

**`lm_head_key`** `str = 'lm_head.weight'`

---

```python
nemo_automodel.components.speculative.dflash.cached_target.DFlashTargetTablesConfig.build(
    target_model_name_or_path: str,
    config: transformers.PreTrainedConfig,
    device: torch.device,
    dtype: torch.dtype
) -> nemo_automodel.components.speculative.dflash.cached_target.DFlashTargetTables
```

Read the target's input and output tables without building the target.

**Parameters:**

**`target_model_name_or_path`** `str`

Hugging Face safetensors checkpoint.

---

**`config`** `PreTrainedConfig`

Target config, with vocabulary, hidden size and tying metadata.

---

**`device`** `torch.device`

Device for the frozen tables.

---

**`dtype`** `torch.dtype`

Compute dtype used by the draft.

---

**Returns:** `DFlashTargetTables`

Frozen tables, sharing the same weight when an omitted output head

```python
nemo_automodel.components.speculative.dflash.cached_target._read_weights(
    source: str,
    keys: tuple[str, str],
    revision: str | None
) -> dict[str, torch.Tensor]
```