mally-2000 commited on
Commit
4aad4b0
·
verified ·
1 Parent(s): 4729388

Simplify model README

Browse files

Keep the model card focused on inference, quick start commands, core results, and remote pipeline loading.

Files changed (1) hide show
  1. README.md +27 -100
README.md CHANGED
@@ -12,33 +12,20 @@ tags:
12
 
13
  # Seismic-LDDPM
14
 
15
- This Hugging Face repository is an inference-only release for seismic impedance
16
- inversion. The trained model weights are hosted directly in this repository in
17
- Diffusers format, together with a minimal inference entry point and a bundled
18
- Overthrust benchmark sample. Training scripts and experiment configs are not
19
- included in this model repository.
20
-
21
- The model takes a low-frequency impedance image (`dipin`) and a seismic record
22
- (`record`) as conditions, then predicts the impedance image.
23
-
24
- ## Repository Contents
25
-
26
- - `vq_model/`, `unet/`, `scheduler/`, `condition_encoder/`: trained model
27
- weights and component configs hosted on Hugging Face.
28
- - `infer.py`: single-sample inference entry point. Defaults to SAII-LDDPM;
29
- pass `CLDM` to run SAII-CLDM sampling.
30
- - `pipeline.py`: thin Diffusers/Hugging Face custom pipeline entry point for
31
- SAII-LDDPM.
32
- - `pipeline_cldm.py`: thin Diffusers/Hugging Face custom pipeline entry point
33
- for SAII-CLDM.
34
- - `codes/pipeline.py`: `SeismicImpInvLDDPMPipeline` and
35
- `SeismicImpInvCLDMPipeline`.
36
- - `codes/dataset.py`: lightweight Overthrust dataset utilities.
37
- - `codes/util.py`: differentiable Overthrust forward operator used by CLDM.
38
- - `codes/eval_overthrust.py`: fixed Overthrust evaluation script.
39
- - `data/Overthrust_trueimp.mat`: bundled Overthrust benchmark input.
40
-
41
- ## Installation
42
 
43
  ```bash
44
  git clone https://huggingface.co/mally-2000/seismic-lddpm
@@ -46,81 +33,38 @@ cd seismic-lddpm
46
  pip install -r requirements.txt
47
  ```
48
 
49
- After cloning, the model weights are already in the local repository
50
- subdirectories listed above. The provided scripts load from `.` by default when
51
- running inside the cloned repository. CUDA is used automatically when available.
52
-
53
- ## Single-Sample Inference
54
-
55
- Run the default SAII-LDDPM sampler:
56
 
57
  ```bash
58
  python infer.py
59
  ```
60
 
61
- Run SAII-CLDM sampling:
62
 
63
  ```bash
64
  python infer.py CLDM
65
  ```
66
 
67
- The script builds one default Overthrust sample internally and writes:
 
68
 
69
  ```text
70
  outputs/infer_LDDPM/
71
  outputs/infer_CLDM/
72
  ```
73
 
74
- Each output directory contains `prediction.npy`, `target.npy`, and
75
- `comparison.png`.
76
-
77
- ## Overthrust Evaluation
78
-
79
- Evaluate SAII-LDDPM on the bundled six-patch Overthrust benchmark:
80
-
81
- ```bash
82
- python codes/eval_overthrust.py LDDPM --model . --output outputs/overthrust_LDDPM
83
- ```
84
-
85
- Evaluate SAII-CLDM:
86
-
87
- ```bash
88
- python codes/eval_overthrust.py CLDM --model . --output outputs/overthrust_CLDM
89
- ```
90
-
91
- The evaluation script uses the fixed benchmark setup:
92
-
93
- - patch indices: `[0, 1, 2, 3, 4, 5]`
94
- - patch size: `256 x 256`
95
- - noise SNR: `15 dB`
96
- - low-frequency input: `dipin_v=0.012`
97
- - Ricker wavelet: `f0=30`, `phase=0`
98
- - seed: `1234`
99
-
100
- Outputs include stitched predictions, a comparison image, and
101
- `metrics_summary.json`.
102
-
103
- ## Local Benchmark Results
104
-
105
- SAII-LDDPM, 1000 DDPM steps:
106
-
107
- | Space | PSNR | SSIM | PCC | RRE | NMSE |
108
- |---|---:|---:|---:|---:|---:|
109
- | Normalized | 30.7698 | 0.9339 | 0.9963 | 0.0435 | 0.001894 |
110
- | Impedance | 33.4413 | 0.9554 | 0.9957 | 0.0324 | 0.001050 |
111
- | VQ reconstruction | 37.7954 | 0.9677 | 0.9983 | 0.0209 | 0.000435 |
112
 
113
- SAII-CLDM, 30 DDIM steps with model-driven resampling:
114
 
115
- | Space | PSNR | SSIM | PCC | RRE | NMSE |
116
  |---|---:|---:|---:|---:|---:|
117
- | Normalized | 31.1638 | 0.9246 | 0.9956 | 0.0422 | 0.001778 |
118
- | Impedance | 33.1312 | 0.9494 | 0.9950 | 0.0342 | 0.001171 |
119
- | VQ reconstruction | 37.7954 | 0.9677 | 0.9983 | 0.0209 | 0.000435 |
120
 
121
- ## Python Usage
122
 
123
- If you cloned this repository, import the pipeline class directly:
124
 
125
  ```python
126
  import torch
@@ -129,21 +73,10 @@ from codes.pipeline import SeismicImpInvLDDPMPipeline
129
  pipe = SeismicImpInvLDDPMPipeline.from_pretrained(
130
  ".",
131
  torch_dtype=torch.float32,
132
- trust_remote_code=True,
133
  ).to("cuda")
134
-
135
- result = pipe(
136
- dipin=dipin,
137
- record=record,
138
- num_inference_steps=1000,
139
- seed=1234,
140
- )
141
-
142
- prediction = result.impedance_samples
143
  ```
144
 
145
- If you want Diffusers to download the model weights and custom pipeline code
146
- from Hugging Face automatically for SAII-LDDPM:
147
 
148
  ```python
149
  import torch
@@ -157,12 +90,9 @@ pipe = DiffusionPipeline.from_pretrained(
157
  ).to("cuda")
158
  ```
159
 
160
- For SAII-CLDM remote loading, use the CLDM custom pipeline file:
161
 
162
  ```python
163
- import torch
164
- from diffusers import DiffusionPipeline
165
-
166
  pipe = DiffusionPipeline.from_pretrained(
167
  "mally-2000/seismic-lddpm",
168
  custom_pipeline="pipeline_cldm",
@@ -170,6 +100,3 @@ pipe = DiffusionPipeline.from_pretrained(
170
  trust_remote_code=True,
171
  ).to("cuda")
172
  ```
173
-
174
- For CLDM, use `SeismicImpInvCLDMPipeline` and pass a seismic forward operator
175
- through `operator=...`; see `infer.py` for the minimal runnable example.
 
12
 
13
  # Seismic-LDDPM
14
 
15
+ Inference-only Hugging Face release for seismic impedance inversion. The model
16
+ weights are hosted in this repository in Diffusers format:
17
+
18
+ ```text
19
+ vq_model/
20
+ unet/
21
+ scheduler/
22
+ condition_encoder/
23
+ ```
24
+
25
+ The repository also includes a minimal Overthrust inference script. Training
26
+ code and experiment configs are not included here.
27
+
28
+ ## Quick Start
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  ```bash
31
  git clone https://huggingface.co/mally-2000/seismic-lddpm
 
33
  pip install -r requirements.txt
34
  ```
35
 
36
+ Run SAII-LDDPM:
 
 
 
 
 
 
37
 
38
  ```bash
39
  python infer.py
40
  ```
41
 
42
+ Run SAII-CLDM:
43
 
44
  ```bash
45
  python infer.py CLDM
46
  ```
47
 
48
+ `infer.py` builds the bundled Overthrust test sample, runs inference, and also
49
+ runs the fixed Overthrust evaluation by default. Outputs are written under:
50
 
51
  ```text
52
  outputs/infer_LDDPM/
53
  outputs/infer_CLDM/
54
  ```
55
 
56
+ ## Results
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
+ Local Overthrust impedance-domain results:
59
 
60
+ | Method | Steps | PSNR | SSIM | PCC | RRE |
61
  |---|---:|---:|---:|---:|---:|
62
+ | SAII-LDDPM | 1000 | 33.4413 | 0.9554 | 0.9957 | 0.0324 |
63
+ | SAII-CLDM | 30 | 33.1312 | 0.9494 | 0.9950 | 0.0342 |
 
64
 
65
+ ## Python Loading
66
 
67
+ Clone the repository and load local weights:
68
 
69
  ```python
70
  import torch
 
73
  pipe = SeismicImpInvLDDPMPipeline.from_pretrained(
74
  ".",
75
  torch_dtype=torch.float32,
 
76
  ).to("cuda")
 
 
 
 
 
 
 
 
 
77
  ```
78
 
79
+ Or let Diffusers download the model weights and custom pipeline code:
 
80
 
81
  ```python
82
  import torch
 
90
  ).to("cuda")
91
  ```
92
 
93
+ For SAII-CLDM remote loading:
94
 
95
  ```python
 
 
 
96
  pipe = DiffusionPipeline.from_pretrained(
97
  "mally-2000/seismic-lddpm",
98
  custom_pipeline="pipeline_cldm",
 
100
  trust_remote_code=True,
101
  ).to("cuda")
102
  ```