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

# Hugging Face

> Load H-Optimus-1 weights directly for non-commercial academic research.

For academic users, H-Optimus-1 weights are available directly on Hugging Face and can be loaded with `timm` — no server or AWS account required.

<Warning>
  **Non-commercial academic use only.** H-Optimus-1 on Hugging Face is released under **CC-BY-NC-ND 4.0**. Commercial use, sale, or monetization (including models trained on its outputs) is prohibited without prior approval. For commercial use, deploy via [AWS](/deployment/platforms/aws-sagemaker) or [on-premise](/deployment/platforms/on-premise), or contact Bioptimus.
</Warning>

## 1. Request access

Access is gated. On [huggingface.co/bioptimus/H-optimus-1](https://huggingface.co/bioptimus/H-optimus-1), accept the terms using your **institutional email** (it must match your Hugging Face account email to be approved).

## 2. Load the model and extract features

H-Optimus-1 expects 224×224 images extracted at 0.5 microns per pixel.

```python theme={null}
from huggingface_hub import login
import torch
import timm
from torchvision import transforms

login()  # token from https://huggingface.co/settings/tokens

model = timm.create_model(
    "hf-hub:bioptimus/H-optimus-1",
    pretrained=True, init_values=1e-5, dynamic_img_size=False,
)
model.to("cuda").eval()

transform = transforms.Compose([
    transforms.ToTensor(),
    transforms.Normalize(
        mean=(0.707223, 0.578729, 0.703617),
        std=(0.211883, 0.230117, 0.177517),
    ),
])

tile = transforms.ToPILImage()(torch.rand(3, 224, 224))

with torch.autocast(device_type="cuda", dtype=torch.float16):
    with torch.inference_mode():
        features = model(transform(tile).unsqueeze(0).to("cuda"))

assert features.shape == (1, 1536)
```

<Info>
  Mixed precision (`autocast`) is recommended for faster inference. The normalization constants above are specific to H-Optimus-1 — use them as shown.
</Info>

## When to use a different option

<CardGroup cols={2}>
  <Card title="Need M-Optimus or commercial use?" href="/deployment/platforms/aws-sagemaker">
    M-Optimus and commercial licensing are available via AWS Marketplace.
  </Card>

  <Card title="Need whole-slide tooling?" href="/guides/get-started/sdk">
    The Bioptimus SDK handles tiling and tissue masking against a deployed server.
  </Card>
</CardGroup>
