> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/curator/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/curator/_mcp/server.

# nemo_curator.stages.math.classifiers.finemath

## Module Contents

### Classes

| Name                                                                                        | Description                                                               |
| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| [`CenterCropTextStage`](#nemo_curator-stages-math-classifiers-finemath-CenterCropTextStage) | Pre-tokenization stage that center-crops the text field to a fixed number |
| [`FineMathClassifier`](#nemo_curator-stages-math-classifiers-finemath-FineMathClassifier)   | FineMath composite: TokenizerStage -> FineMathModelStage.                 |
| [`FineMathModelStage`](#nemo_curator-stages-math-classifiers-finemath-FineMathModelStage)   | Hugging Face sequence classification model stage for FineMath.            |

### Data

[`FINEMATH_MODEL_ID`](#nemo_curator-stages-math-classifiers-finemath-FINEMATH_MODEL_ID)

[`MAX_SEQ_LENGTH`](#nemo_curator-stages-math-classifiers-finemath-MAX_SEQ_LENGTH)

### API

```python
class nemo_curator.stages.math.classifiers.finemath.CenterCropTextStage(
    text_field: str = 'text',
    center_crop_chars: int = 10000
)
```

**Bases:** [ProcessingStage\[DocumentBatch, DocumentBatch\]](/nemo-curator/nemo_curator/stages/base#nemo_curator-stages-base-ProcessingStage)

Pre-tokenization stage that center-crops the text field to a fixed number
of characters to keep central context.

**`center_crop_chars`** `= max(0, int(center_crop_chars))`

---

**`name`**

---

```python
nemo_curator.stages.math.classifiers.finemath.CenterCropTextStage._mid_slice(
    s: str,
    n: int
) -> str
```

staticmethod

```python
nemo_curator.stages.math.classifiers.finemath.CenterCropTextStage.inputs() -> tuple[list[str], list[str]]
```

```python
nemo_curator.stages.math.classifiers.finemath.CenterCropTextStage.outputs() -> tuple[list[str], list[str]]
```

```python
nemo_curator.stages.math.classifiers.finemath.CenterCropTextStage.process(
    batch: nemo_curator.tasks.DocumentBatch
) -> nemo_curator.tasks.DocumentBatch
```

```python
class nemo_curator.stages.math.classifiers.finemath.FineMathClassifier(
    cache_dir: str | None = None,
    float_score_column: str = 'finemath_scores',
    int_score_column: str = 'finemath_int_scores',
    text_field: str = 'text',
    max_chars: int | None = None,
    max_seq_length: int = MAX_SEQ_LENGTH,
    sort_by_length: bool = False,
    model_inference_batch_size: int = 1024,
    autocast: bool = True,
    center_crop_chars: int | None = 10000
)
```

Dataclass

**Bases:** [CompositeStage\[DocumentBatch, DocumentBatch\]](/nemo-curator/nemo_curator/stages/base#nemo_curator-stages-base-CompositeStage)

FineMath composite: TokenizerStage -> FineMathModelStage.

**`autocast`** `bool = True`

---

**`cache_dir`** `str | None = None`

---

**`center_crop_chars`** `int | None = 10000`

---

**`float_score_column`** `str = 'finemath_scores'`

---

**`int_score_column`** `str = 'finemath_int_scores'`

---

**`max_chars`** `int | None = None`

---

**`max_seq_length`** `int = MAX_SEQ_LENGTH`

---

**`model_inference_batch_size`** `int = 1024`

---

**`sort_by_length`** `bool = False`

---

**`text_field`** `str = 'text'`

---

```python
nemo_curator.stages.math.classifiers.finemath.FineMathClassifier.__post_init__() -> None
```

```python
nemo_curator.stages.math.classifiers.finemath.FineMathClassifier.decompose() -> list[nemo_curator.stages.base.ProcessingStage]
```

```python
class nemo_curator.stages.math.classifiers.finemath.FineMathModelStage(
    model_identifier: str,
    cache_dir: str | None = None,
    float_score_column: str = 'finemath_scores',
    int_score_column: str = 'finemath_int_scores',
    model_inference_batch_size: int = 256,
    has_seq_order: bool = True,
    autocast: bool = True
)
```

**Bases:** [ModelStage](/nemo-curator/nemo_curator/stages/text/models/model#nemo_curator-stages-text-models-model-ModelStage)

Hugging Face sequence classification model stage for FineMath.

Outputs columns:

* finemath\_scores (float list)
* finemath\_int\_scores (int list)

```python
nemo_curator.stages.math.classifiers.finemath.FineMathModelStage._configure_forward(
    model: torch.nn.Module
) -> torch.nn.Module
```

staticmethod

```python
nemo_curator.stages.math.classifiers.finemath.FineMathModelStage._setup(
    local_files_only: bool = True
) -> None
```

```python
nemo_curator.stages.math.classifiers.finemath.FineMathModelStage.create_output_dataframe(
    df_cpu: pandas.DataFrame,
    collected_output: dict[str, numpy.ndarray]
) -> pandas.DataFrame
```

```python
nemo_curator.stages.math.classifiers.finemath.FineMathModelStage.outputs() -> tuple[list[str], list[str]]
```

```python
nemo_curator.stages.math.classifiers.finemath.FineMathModelStage.process_model_output(
    outputs: torch.Tensor,
    _: dict[str, torch.Tensor] | None = None
) -> dict[str, numpy.ndarray]
```

```python
nemo_curator.stages.math.classifiers.finemath.FINEMATH_MODEL_ID = 'HuggingFaceTB/finemath-classifier'
```

```python
nemo_curator.stages.math.classifiers.finemath.MAX_SEQ_LENGTH = 512
```