From 08b158d5806adaeaa21ee397245fb8a8eb2e70fb Mon Sep 17 00:00:00 2001 From: Brett Kuprel Date: Thu, 30 Jun 2022 16:50:04 -0400 Subject: [PATCH] updated readme --- README.md | 2 +- min_dalle/load_params.py | 2 +- min_dalle/min_dalle_torch.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 48ce374..6c10b9b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/kuprel/min-dalle/blob/main/min_dalle.ipynb)   [![Replicate](https://replicate.com/kuprel/min-dalle/badge)](https://replicate.com/kuprel/min-dalle) -This is a minimal implementation of Boris Dayma's [DALL·E Mini](https://github.com/borisdayma/dalle-mini). It has been stripped to the bare essentials necessary for doing inference, and converted to PyTorch. To run the torch model, the only third party dependencies are numpy and torch. Flax is used to convert the weights (which can be saved with `torch.save` once the model is loaded), and wandb is only used to download the models. +This is a minimal implementation of Boris Dayma's [DALL·E Mini](https://github.com/borisdayma/dalle-mini). It has been stripped to the bare essentials necessary for doing inference, and converted to PyTorch. To run the torch model, the only third party dependencies are numpy and torch. Flax is used to convert the weights (which are saved with `torch.save` the first time the model is loaded), and wandb is only used to download the models. It currently takes about 10 seconds to generate an avocado armchair with DALL·E Mega in PyTorch on Colab with a reusable model and high-RAM GPU runtime. diff --git a/min_dalle/load_params.py b/min_dalle/load_params.py index 4c647d5..c51a3a9 100644 --- a/min_dalle/load_params.py +++ b/min_dalle/load_params.py @@ -107,7 +107,7 @@ def convert_dalle_bart_torch_from_flax_params( return P -def convert_and_save_mega_torch_params(is_mega: bool, model_path: str): +def convert_and_save_torch_params(is_mega: bool, model_path: str): print("converting params to torch") layer_count = 24 if is_mega else 12 flax_params = load_dalle_bart_flax_params(model_path) diff --git a/min_dalle/min_dalle_torch.py b/min_dalle/min_dalle_torch.py index 829dff6..e5a0699 100644 --- a/min_dalle/min_dalle_torch.py +++ b/min_dalle/min_dalle_torch.py @@ -7,7 +7,7 @@ torch.set_grad_enabled(False) torch.set_num_threads(os.cpu_count()) from .load_params import ( - convert_and_save_mega_torch_params, + convert_and_save_torch_params, load_dalle_bart_flax_params ) from .min_dalle_base import MinDalleBase @@ -36,7 +36,7 @@ class MinDalleTorch(MinDalleBase): is_converted = os.path.exists(self.encoder_params_path) is_converted &= os.path.exists(self.decoder_params_path) if not is_converted: - convert_and_save_mega_torch_params(is_mega, self.model_path) + convert_and_save_torch_params(is_mega, self.model_path) if is_reusable: self.init_encoder()