# Source: https://github.com/ml-explore/mlx-lm/blob/main/mlx_lm/perplexity.py

## API Reference

```python
"""
Evaluate perplexity (PPL) of MLX models.
def load_data(
def eval_ppl(model, data, batch_size=8):
    """
    Evaluate perplexity on a dataset with standard error calculation.

    Args:
        model: The model to evaluate
        data: Tokenized data tensor
        batch_size: Batch size for evaluation

    Returns:
        tuple: (perplexity, standard_error)
def main():
```