Views
No views yet
Trainer, DeepSpeed, etc.PretrainedConfig, PreTrainedModel, etc., allowing seamless use in Hugging Face-style training and inference workflows.nkkbr/hiera-large-in-sam2.11git clone https://github.com/facebookresearch/sam2.git && cd sam2
2pip install -e .1from hiera_encoder import HieraVisionModel
2
3# Load the Hiera module from Hugging Face
4model = HieraVisionModel.from_pretrained("nkkbr/hiera-large-in-sam2.1")
5
6# Get the raw Hiera model
7model = model.hiera
8
9# Print model parameters
10for name, param in model.named_parameters():
11 print(f"{name:50} {param.shape}")1import torch
2from sam2.sam2_image_predictor import SAM2ImagePredictor
3
4# Load SAM2.1 predictor from Meta's official release
5predictor = SAM2ImagePredictor.from_pretrained("facebook/sam2.1-hiera-base-plus")
6hiera_model_in_predictor = predictor.model.image_encoder.trunk
7
8# Compare weights
9for name, param in model.named_parameters():
10 if not torch.equal(param, hiera_model_in_predictor.state_dict()[name]):
11 print(f"The parameter {name} has different weights in the two models.")
12
13print("Comparison complete!")