Quickstart

This guide will help you get started with AstroPT quickly.

Loading a pre-trained model

To load and run a pre-trained AstroPT model from Hugging Face πŸ€—, use the load_astropt function:

from astropt.model_utils import load_astropt

model, model_args = load_astropt(
    repo_id="smith42/astropt_sparse",
    path="astropt/p16k10",
    weights_filename="ckpt.pt",
)
model = model.to("cuda")  # Move to GPU if available

Available pre-trained models

Below are some pre-trained models you can load with the code snippet above:

DESI Legacy Survey Model

DESI Legacy Survey Model (v2.0)

Euclid Model

Basic model usage

Here’s a simple example of how to use the model for inference:

import torch
from astropt.model_utils import load_astropt

# Load the model
model, model_args = load_astropt(
    repo_id="smith42/astropt_sparse",
    path="astropt/p16k10",
    weights_filename="ckpt.pt",
)
model = model.to("cuda")

# Prepare your input data
# This is a simplified example - actual preprocessing depends on your data
input_data = preprocess_your_data(your_data)

# Convert to tensor and move to the same device as the model
input_tensor = torch.tensor(input_data).to("cuda")

# Run inference
with torch.no_grad():
    output = model(input_tensor)

# Process the output
processed_output = process_output(output)