mally-2000 commited on
Commit
a61817b
·
verified ·
1 Parent(s): c3aab43

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +62 -13
README.md CHANGED
@@ -8,39 +8,88 @@ For the Diffusers-format release with bundled inference code, see
8
 
9
  | File | Description |
10
  | --- | --- |
11
- | `stage1_vqgan.ckpt` | Stage 1 VQGAN checkpoint (first stage autoencoder). |
12
- | `stage2_ldm.ckpt` | Stage 2 latent diffusion / CLDM checkpoint (original A101 run, epoch 212 / step 13,991). |
13
- | `stage2_ldm_config.yaml` | Exact Stage 2 training config used for `stage2_ldm.ckpt`, with env-based paths. |
14
- | `ldm_backend_vqgan_marmousi.yaml` | Stage 1 training config. |
15
  | `ldm_backend_a101_train_hwd.yaml` | Stage 2 training config from the refactored repo. |
16
  | `ldm_backend_lightning.yaml` | Lightning trainer, logger, and Overthrust eval callback config. |
17
 
18
- ## Usage
19
 
20
- Clone the training code repository and copy these checkpoints/configs into it
21
- (or set the corresponding `.env` paths):
22
 
23
  ```bash
24
- cp stage1_vqgan.ckpt stage2_ldm.ckpt <your_repo>/models/
25
- cp stage2_ldm_config.yaml <your_repo>/configs/
 
 
 
26
  ```
27
 
28
- Then set in `.env`:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  ```bash
31
  FIRST_STAGE_CKPT=./models/stage1_vqgan.ckpt
 
32
  ```
33
 
34
- And run the Stage 2 training resuming from `stage2_ldm.ckpt`, or evaluate it
35
- with:
36
 
37
  ```bash
38
- python eval_overthrust.py CLDM \
39
  --ckpt ./models/stage2_ldm.ckpt \
 
40
  --output runs/eval_cldm \
41
  --device cuda --steps 30
42
  ```
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  ## Paper
45
 
46
  SAII-CLDM: Seismic Acoustic Impedance Inversion through Conditional Latent Diffusion Model.
 
8
 
9
  | File | Description |
10
  | --- | --- |
11
+ | `stage1_vqgan.ckpt` | Stage 1 VQGAN checkpoint (first stage autoencoder), 721 MB. |
12
+ | `stage2_ldm.ckpt` | Stage 2 latent diffusion / CLDM checkpoint (original A101 run, epoch 212 / step 13,991), 4.3 GB. |
13
+ | `stage2_ldm_config.yaml` | Exact Stage 2 training config used for `stage2_ldm.ckpt`, with env-based relative paths. |
14
+ | `ldm_backend_vqgan_marmousi.yaml` | Stage 1 training config from the refactored repo. |
15
  | `ldm_backend_a101_train_hwd.yaml` | Stage 2 training config from the refactored repo. |
16
  | `ldm_backend_lightning.yaml` | Lightning trainer, logger, and Overthrust eval callback config. |
17
 
18
+ ## Download the checkpoints
19
 
20
+ With [huggingface_hub](https://huggingface.co/docs/huggingface_hub):
 
21
 
22
  ```bash
23
+ pip install huggingface_hub
24
+ huggingface-cli download \
25
+ --repo-type model \
26
+ --local-dir ./saii-cldm-ldm-checkpoints \
27
+ mally-2000/saii-cldm-ldm-checkpoints
28
  ```
29
 
30
+ Or in Python:
31
+
32
+ ```python
33
+ from huggingface_hub import snapshot_download
34
+ snapshot_download(
35
+ "mally-2000/saii-cldm-ldm-checkpoints",
36
+ repo_type="model",
37
+ local_dir="./saii-cldm-ldm-checkpoints",
38
+ )
39
+ ```
40
+
41
+ ## Run inference on Overthrust
42
+
43
+ Clone the training code repository and copy the checkpoints/configs into it:
44
+
45
+ ```bash
46
+ git clone <SAII-CLDM-training-repo>
47
+ cd SAII-CLDM
48
+ mkdir -p models
49
+ cp saii-cldm-ldm-checkpoints/stage1_vqgan.ckpt models/
50
+ cp saii-cldm-ldm-checkpoints/stage2_ldm.ckpt models/
51
+ cp saii-cldm-ldm-checkpoints/stage2_ldm_config.yaml configs/
52
+ ```
53
+
54
+ Set the required paths in `.env` (copy from `.env.example`):
55
 
56
  ```bash
57
  FIRST_STAGE_CKPT=./models/stage1_vqgan.ckpt
58
+ OVERTHRUST_DATA_DIR=./data/overthrust
59
  ```
60
 
61
+ Then run CLDM inference on the Overthrust benchmark:
 
62
 
63
  ```bash
64
+ CUDA_VISIBLE_DEVICES=0 python eval_overthrust.py CLDM \
65
  --ckpt ./models/stage2_ldm.ckpt \
66
+ --config ./configs/stage2_ldm_config.yaml \
67
  --output runs/eval_cldm \
68
  --device cuda --steps 30
69
  ```
70
 
71
+ If GPU 0 is occupied or you hit OOM, switch to another GPU:
72
+
73
+ ```bash
74
+ CUDA_VISIBLE_DEVICES=1 python eval_overthrust.py CLDM \
75
+ --ckpt ./models/stage2_ldm.ckpt \
76
+ --config ./configs/stage2_ldm_config.yaml \
77
+ --output runs/eval_cldm \
78
+ --device cuda --steps 30
79
+ ```
80
+
81
+ The script will save `metrics_summary.json`, numpy arrays, and a comparison figure under `runs/eval_cldm`.
82
+
83
+ ## Resume training
84
+
85
+ To resume Stage 2 training from this checkpoint:
86
+
87
+ ```bash
88
+ CUDA_VISIBLE_DEVICES=0 python train_ldm_backend.py -t \
89
+ --resume ./models/stage2_ldm.ckpt \
90
+ --base ./configs/stage2_ldm_config.yaml ./configs/ldm_backend_lightning.yaml
91
+ ```
92
+
93
  ## Paper
94
 
95
  SAII-CLDM: Seismic Acoustic Impedance Inversion through Conditional Latent Diffusion Model.