changes to model card
Browse files
README.md
CHANGED
@@ -28,10 +28,33 @@ This model can be directly used to generate realistic medical images from text p
|
|
28 |
## How to Get Started with the Model
|
29 |
|
30 |
```python
|
|
|
|
|
31 |
from diffusers.pipelines import StableDiffusionPipeline
|
32 |
|
33 |
pipe = StableDiffusionPipeline.from_pretrained(sd_folder_path, revision="fp16")
|
|
|
|
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
```
|
36 |
|
37 |
|
@@ -39,14 +62,11 @@ pipe = StableDiffusionPipeline.from_pretrained(sd_folder_path, revision="fp16")
|
|
39 |
|
40 |
### Training Data
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
[More Information Needed]
|
45 |
|
46 |
### Training Procedure
|
47 |
|
48 |
-
|
49 |
-
|
50 |
|
51 |
#### Metrics
|
52 |
|
@@ -54,12 +74,21 @@ This model has been evaluated using the Fréchet inception distance (FID) Score
|
|
54 |
|
55 |
### Results
|
56 |
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
|
60 |
## Environmental Impact
|
61 |
|
62 |
-
|
63 |
|
64 |
## Citation
|
65 |
|
|
|
28 |
## How to Get Started with the Model
|
29 |
|
30 |
```python
|
31 |
+
import os
|
32 |
+
from safetensors.torch import load_file
|
33 |
from diffusers.pipelines import StableDiffusionPipeline
|
34 |
|
35 |
pipe = StableDiffusionPipeline.from_pretrained(sd_folder_path, revision="fp16")
|
36 |
+
exp_path = os.path.join('unet', 'diffusion_pytorch_model.safetensors')
|
37 |
+
state_dict = load_file(exp_path)
|
38 |
|
39 |
+
# Load the adapted U-Net
|
40 |
+
pipe.unet.load_state_dict(state_dict, strict=False)
|
41 |
+
pipe.to('cuda:0')
|
42 |
+
|
43 |
+
# Generate images with text prompts
|
44 |
+
|
45 |
+
TEXT_PROMPT = "No acute cardiopulmonary abnormality."
|
46 |
+
GUIDANCE_SCALE = 4
|
47 |
+
INFERENCE_STEPS = 75
|
48 |
+
|
49 |
+
result_image = pipe(
|
50 |
+
prompt=TEXT_PROMPT,
|
51 |
+
height=224,
|
52 |
+
width=224,
|
53 |
+
guidance_scale=GUIDANCE_SCALE,
|
54 |
+
num_inference_steps=INFERENCE_STEPS,
|
55 |
+
)
|
56 |
+
|
57 |
+
result_pil_image = result_image["images"][0]
|
58 |
```
|
59 |
|
60 |
|
|
|
62 |
|
63 |
### Training Data
|
64 |
|
65 |
+
This model has been fine-tuned on 110K image-text pairs from the MIMIC dataset.
|
|
|
|
|
66 |
|
67 |
### Training Procedure
|
68 |
|
69 |
+
The training procedure has been described in detail in Section 4.3 of this [paper](https://arxiv.org/abs/2305.08252).
|
|
|
70 |
|
71 |
#### Metrics
|
72 |
|
|
|
74 |
|
75 |
### Results
|
76 |
|
77 |
+
| Fine-Tuning Strategy | FID Score |
|
78 |
+
|------------------------|-----------|
|
79 |
+
| Full FT | 58.74 |
|
80 |
+
| Attention | 52.41 |
|
81 |
+
| Bias | 20.81 |
|
82 |
+
| Norm | 29.84 |
|
83 |
+
| Bias+Norm+Attention | 35.93 |
|
84 |
+
| LoRA | 439.65 |
|
85 |
+
| SV-Diff | 23.59 |
|
86 |
+
| DiffFit | 42.5 |
|
87 |
|
88 |
|
89 |
## Environmental Impact
|
90 |
|
91 |
+
Using Parameter-Efficient Fine-Tuning potentially causes **lesser** harm to the environment since we fine-tune a significantly lesser number of parameters in a model. This results in much lesser computing and hardware requirements.
|
92 |
|
93 |
## Citation
|
94 |
|