Skip to contents

Loads models from local training board, hub, or custom board. By default, checks local models first, then falls back to the public hub.

Usage

from_pretrained(
  model_id,
  version = NULL,
  board = NULL,
  device = "cpu",
  confidence = 0.5
)

Arguments

model_id

Model name (e.g., "shell_v3")

version

Specific version (NULL for latest)

board

Board to load from:

  • NULL (default): check local first (.petrographer/models/), then hub

  • "local": only check locally trained models (.petrographer/models/)

  • Custom board object

device

Device: "cpu", "cuda", or "mps"

confidence

Detection threshold

Value

PetrographyModel object

Examples

if (FALSE) { # \dontrun{
# Smart loading (checks local first, then hub)
model <- from_pretrained("my_model")

# Force local only
model <- from_pretrained("my_model", board = "local")

# Force hub only
hub_board <- pins::board_url("https://flmnh-ai.github.io/petrographer/pins/")
model <- from_pretrained("public_model", board = hub_board)
} # }