> ## Documentation Index
> Fetch the complete documentation index at: https://docs.standardmodel.bio/llms.txt
> Use this file to discover all available pages before exploring further.

# Install the Standard Model

> This guide walks you through how to set up your environment and download our flagship JEPA-based multimodal foundation model.

## Quickstart (Recommended)

```bash theme={null}
bash -c "$(curl -fsSL https://docs.standardmodel.bio/quickstart.sh)"
```

This script will:

1. Clone the [quickstart repo](https://github.com/standardmodelbio/quickstart) with `demo.py` and all dependencies.
2. Install [uv](https://docs.astral.sh/uv/) if not already present.
3. Run `uv sync` to install the exact locked dependency set (PyTorch, transformers, `smb_utils`, etc.).

<Tip>
  GPU support is strongly recommended. `smb-v1-1.7b` has 1.7B parameters and requires approximately 16GB GPU memory for inference.
</Tip>

<Accordion title="Manual Installation">
  **Requirements:** Python 3.11+, Git, and [uv](https://docs.astral.sh/uv/).

  <Note>
    The quickstart uses [uv](https://docs.astral.sh/uv/) for dependency management. If you prefer a different tool (conda, pip, etc.), refer to `pyproject.toml` in the [quickstart repo](https://github.com/standardmodelbio/quickstart) for the list of dependencies.
  </Note>

  <Steps>
    <Step title="Install uv">
      ```bash theme={null}
      curl -LsSf https://astral.sh/uv/install.sh | sh
      ```
    </Step>

    <Step title="Clone and install">
      Once complete, run the demo:

      ```bash theme={null}
      cd quickstart
      uv run python demo.py
      ```

      ```bash theme={null}
      git clone https://github.com/standardmodelbio/quickstart.git
      cd quickstart
      uv sync
      ```
    </Step>
  </Steps>

  All dependencies (PyTorch, transformers, `smb_utils`, etc.) are installed from the lockfile, ensuring a reproducible environment.

  ### Verify Your Installation

  From the `quickstart/` directory, verify that everything is working:

  ```bash theme={null}
  uv run python -c "
  import torch
  from transformers import AutoModelForCausalLM, AutoTokenizer

  # Check PyTorch and CUDA
  print(f'PyTorch version: {torch.__version__}')
  print(f'CUDA available: {torch.cuda.is_available()}')

  # Load smb-v1-1.7b
  model_id = 'standardmodelbio/smb-v1-1.7b'
  tokenizer = AutoTokenizer.from_pretrained(model_id)
  model = AutoModelForCausalLM.from_pretrained(
      model_id,
      trust_remote_code=True,
      device_map='auto'
  )

  print('smb-v1-1.7b loaded successfully!')
  "
  ```
</Accordion>

## Next Steps

<Columns cols={2}>
  <Card icon="stethoscope" href="/example" title="Try a full example with synthetic data" />

  <Card icon="code-fork" href="https://docs.standardmodel.bio/your-own-data" title="Use the model on your own data" />
</Columns>

### Troubleshooting

<CardGroup cols={2}>
  <Card icon="microchip" title="CUDA Not Detected">
    Ensure NVIDIA drivers are up to date. Run `nvidia-smi` to verify GPU is accessible.
  </Card>

  <Card icon="memory" title="Out of Memory">
    Reduce memory use via `torch.float16` or quantization (see below).
  </Card>

  <Card icon="lock" title="Model Access Denied">
    Some models may require authentication. Run `huggingface-cli login` with your token.
  </Card>

  <Card icon="gauge" title="Slow Download">
    Model downloads can be large (several GB). Ensure stable connection and sufficient disk space.
  </Card>
</CardGroup>

### Memory optimization

For large cohorts and/or limited GPU memory, use half-precision or quantization:

<Tabs>
  <Tab title="Float16">
    ```python theme={null}
    model = AutoModelForCausalLM.from_pretrained(
        model_id,
        trust_remote_code=True,
        torch_dtype=torch.float16,
        device_map="auto"
    )
    ```

    **Memory:** \~8GB
  </Tab>

  <Tab title="8-bit Quantization">
    ```python theme={null}
    model = AutoModelForCausalLM.from_pretrained(
        model_id,
        trust_remote_code=True,
        load_in_8bit=True,
        device_map="auto"
    )
    ```

    **Memory:** \~4GB
  </Tab>
</Tabs>

### Contact Us

Having trouble, or just want to talk about your project? Send an email to [erik@standardmodel.bio](mailto:erik@standardmodel.bio)
