Image-to-Image
Diffusers
Safetensors
SeismicImpInvCLDMPipeline
seismic-inversion
impedance-inversion
diffusion
ddpm
cldm
overthrust
synthetic-data
Instructions to use mally-2000/saii-cldm-synthetic with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use mally-2000/saii-cldm-synthetic with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("mally-2000/saii-cldm-synthetic", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Simplify model README
Browse filesKeep the model card focused on inference, quick start commands, core results, and remote pipeline loading.
README.md
CHANGED
|
@@ -12,33 +12,20 @@ tags:
|
|
| 12 |
|
| 13 |
# Seismic-LDDPM
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 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 |
-
|
| 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
|
| 62 |
|
| 63 |
```bash
|
| 64 |
python infer.py CLDM
|
| 65 |
```
|
| 66 |
|
| 67 |
-
|
|
|
|
| 68 |
|
| 69 |
```text
|
| 70 |
outputs/infer_LDDPM/
|
| 71 |
outputs/infer_CLDM/
|
| 72 |
```
|
| 73 |
|
| 74 |
-
|
| 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 |
-
|
| 114 |
|
| 115 |
-
|
|
| 116 |
|---|---:|---:|---:|---:|---:|
|
| 117 |
-
|
|
| 118 |
-
|
|
| 119 |
-
| VQ reconstruction | 37.7954 | 0.9677 | 0.9983 | 0.0209 | 0.000435 |
|
| 120 |
|
| 121 |
-
## Python
|
| 122 |
|
| 123 |
-
|
| 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 |
-
|
| 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
|
| 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 |
```
|
|
|
|
|
|
|
|
|