Views
No views yet
README.md
sd-v1-5/
└── sae/
├── exp32_topk16/
│ ├── config.json
│ ├── model.pt
│ └── merged_feature_sums.pt
├── exp36_topk32/
│ ├── config.json
│ ├── model.pt
│ └── merged_feature_sums.pt
└── exp36_topk64/
├── config.json
├── model.pt
└── merged_feature_sums.ptconfig.json: SAE architecture configuration (dimensions, hyperparameters)model.pt: Trained SAE weights (encoder and decoder)merged_feature_sums.pt: Aggregated feature activation statistics across training datapip install huggingface_hub torch1from huggingface_hub import hf_hub_download
2import torch
3import json
4
5# Choose your model
6REPO_ID = "jrsh/sd-control-and-representation"
7SUBFOLDER = "sd-v1-5/sae/exp36_topk32" # Choose: exp32_topk16, exp36_topk32, or exp36_topk64
8
9# 1. Load configuration
10config_path = hf_hub_download(
11 repo_id=REPO_ID,
12 subfolder=SUBFOLDER,
13 filename="config.json"
14)
15with open(config_path, 'r') as f:
16 config = json.load(f)
17
18# 2. Load model weights
19model_path = hf_hub_download(
20 repo_id=REPO_ID,
21 subfolder=SUBFOLDER,
22 filename="model.pt"
23)
24sae_state_dict = torch.load(model_path, map_location='cpu')
25
26# 3. Load feature statistics
27feature_sums_path = hf_hub_download(
28 repo_id=REPO_ID,
29 subfolder=SUBFOLDER,
30 filename="merged_feature_sums.pt"
31)
32feature_sums = torch.load(feature_sums_path, map_location='cpu')
33
34print(f"Successfully loaded SAE from {SUBFOLDER}")
35print(f"Config: {config}")