Skip to content

Commit

Permalink
1. add 4096 aspect ratio;
Browse files Browse the repository at this point in the history
2. pre-commit

Signed-off-by: lawrence-cj <[email protected]>
  • Loading branch information
lawrence-cj committed Jan 8, 2025
1 parent 59cfff0 commit 124301e
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 6 deletions.
7 changes: 6 additions & 1 deletion app/sana_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@


from diffusion import DPMS, FlowEuler
from diffusion.data.datasets.utils import ASPECT_RATIO_512_TEST, ASPECT_RATIO_1024_TEST, ASPECT_RATIO_2048_TEST
from diffusion.data.datasets.utils import (
ASPECT_RATIO_512_TEST,
ASPECT_RATIO_1024_TEST,
ASPECT_RATIO_2048_TEST,
ASPECT_RATIO_4096_TEST,
)
from diffusion.model.builder import build_model, get_tokenizer_and_text_encoder, get_vae, vae_decode
from diffusion.model.utils import get_weight_dtype, prepare_prompt_ar, resize_and_crop_tensor
from diffusion.utils.config import SanaConfig, model_init_config
Expand Down
3 changes: 2 additions & 1 deletion asset/docs/model_zoo.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ image[0].save('sana.png')
```

#### 2). For 4K models

4K models need [patch_conv](https://github.com/mit-han-lab/patch_conv) to avoid OOM issue.(80GB GPU is recommended)

run `pip install patch_conv` first, then
Expand Down Expand Up @@ -113,4 +114,4 @@ image = pipe(
)[0]

image[0].save("sana_4K.png")
```
```
7 changes: 6 additions & 1 deletion scripts/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
warnings.filterwarnings("ignore") # ignore warning

from diffusion import DPMS, FlowEuler, SASolverSampler
from diffusion.data.datasets.utils import ASPECT_RATIO_512_TEST, ASPECT_RATIO_1024_TEST, ASPECT_RATIO_2048_TEST
from diffusion.data.datasets.utils import (
ASPECT_RATIO_512_TEST,
ASPECT_RATIO_1024_TEST,
ASPECT_RATIO_2048_TEST,
ASPECT_RATIO_4096_TEST,
)
from diffusion.model.builder import build_model, get_tokenizer_and_text_encoder, get_vae, vae_decode
from diffusion.model.utils import get_weight_dtype, prepare_prompt_ar
from diffusion.utils.config import SanaConfig, model_init_config
Expand Down
1 change: 1 addition & 0 deletions scripts/inference_dpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
ASPECT_RATIO_512_TEST,
ASPECT_RATIO_1024_TEST,
ASPECT_RATIO_2048_TEST,
ASPECT_RATIO_4096_TEST,
get_chunks,
)
from diffusion.model.builder import build_model, get_tokenizer_and_text_encoder, get_vae, vae_decode
Expand Down
7 changes: 6 additions & 1 deletion scripts/inference_geneval.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
warnings.filterwarnings("ignore") # ignore warning

from diffusion import DPMS, FlowEuler, SASolverSampler
from diffusion.data.datasets.utils import ASPECT_RATIO_512_TEST, ASPECT_RATIO_1024_TEST, ASPECT_RATIO_2048_TEST
from diffusion.data.datasets.utils import (
ASPECT_RATIO_512_TEST,
ASPECT_RATIO_1024_TEST,
ASPECT_RATIO_2048_TEST,
ASPECT_RATIO_4096_TEST,
)
from diffusion.model.builder import build_model, get_tokenizer_and_text_encoder, get_vae, vae_decode
from diffusion.model.utils import get_weight_dtype, prepare_prompt_ar
from diffusion.utils.config import SanaConfig, model_init_config
Expand Down
7 changes: 6 additions & 1 deletion scripts/inference_image_reward.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@
from tqdm import tqdm

from diffusion import DPMS, FlowEuler, SASolverSampler
from diffusion.data.datasets.utils import ASPECT_RATIO_512_TEST, ASPECT_RATIO_1024_TEST, ASPECT_RATIO_2048_TEST
from diffusion.data.datasets.utils import (
ASPECT_RATIO_512_TEST,
ASPECT_RATIO_1024_TEST,
ASPECT_RATIO_2048_TEST,
ASPECT_RATIO_4096_TEST,
)
from diffusion.model.builder import build_model, get_tokenizer_and_text_encoder, get_vae, vae_decode
from diffusion.model.utils import get_weight_dtype, prepare_prompt_ar
from diffusion.utils.config import SanaConfig, model_init_config
Expand Down
7 changes: 6 additions & 1 deletion scripts/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@

from asset.examples import examples
from diffusion import DPMS, FlowEuler, SASolverSampler
from diffusion.data.datasets.utils import ASPECT_RATIO_512_TEST, ASPECT_RATIO_1024_TEST, ASPECT_RATIO_2048_TEST
from diffusion.data.datasets.utils import (
ASPECT_RATIO_512_TEST,
ASPECT_RATIO_1024_TEST,
ASPECT_RATIO_2048_TEST,
ASPECT_RATIO_4096_TEST,
)
from diffusion.model.builder import build_model, get_tokenizer_and_text_encoder, get_vae, vae_decode
from diffusion.model.utils import get_weight_dtype, prepare_prompt_ar, resize_and_crop_tensor
from diffusion.utils.config import SanaConfig, model_init_config
Expand Down

0 comments on commit 124301e

Please sign in to comment.