# Resume and Replay

Resume interrupted training or replay trained models.

## Resume Training

Use `train@{predir}` to resume from a previous run:

```bash
# Resume from latest run of this spec
slm-lab run slm_lab/spec/benchmark/ppo/ppo_cartpole.json ppo_cartpole train@latest

# Resume from specific folder
slm-lab run slm_lab/spec/benchmark/ppo/ppo_cartpole.json ppo_cartpole train@data/ppo_cartpole_2026_01_30_221924
```

`train@latest` resolves to the most recent `data/{spec_name}_*/` folder.

### Extending Training

To continue a completed run (e.g., 100k → 200k frames):

1. Edit the spec's `max_frame`
2. Resume with `train@latest`

## Replay Mode

Use `enjoy@{spec_file}` to replay a trained model with rendering:

```bash
slm-lab run slm_lab/spec/benchmark/ppo/ppo_cartpole.json ppo_cartpole enjoy@data/ppo_cartpole_2026_01_30_221924/ppo_cartpole_t0_spec.json
```

In enjoy mode, the spec file and spec name args are ignored—everything loads from the `enjoy@` path.

Enjoy mode finds the best session (by `total_reward_ma`) and loads its `ckpt-best` model checkpoint.

## Replaying Published Benchmarks

Download and replay trained agents from [HuggingFace](https://huggingface.co/datasets/SLM-Lab/benchmark):

```bash
slm-lab list              # List available experiments
slm-lab pull ppo_cartpole # Download trained model
slm-lab run slm_lab/spec/benchmark/ppo/ppo_cartpole.json ppo_cartpole enjoy@data/ppo_cartpole_2026_01_30_221924/ppo_cartpole_t0_spec.json
```

See [Public Benchmark Data](/slm-lab/benchmark-results/public-benchmark-data.md) for the full list.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://slm-lab.gitbook.io/slm-lab/using-slm-lab/resume-and-replay.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
