From bd6d910ca3744d75bf704e6e7039f97f71014bd5 Mon Sep 17 00:00:00 2001 From: Alban Lecocq Date: Wed, 13 Nov 2024 15:14:03 +0100 Subject: [PATCH 1/3] [MLX LM] Fix f-string formatting in memory warning message (#1105) * Fix missing f-prefix for string interpolation in model size warning * Ensures proper display of memory values in MB for model and max size --- llms/mlx_lm/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llms/mlx_lm/utils.py b/llms/mlx_lm/utils.py index 8893b570..d4afd428 100644 --- a/llms/mlx_lm/utils.py +++ b/llms/mlx_lm/utils.py @@ -61,8 +61,8 @@ def wired_limit(model: nn.Module, streams: Optional[List[mx.Stream]] = None): model_mb = model_bytes // 2**20 max_rec_mb = max_rec_size // 2**20 print( - "[WARNING] Generating with a model that requires {model_mb} MB " - "which is close to the maximum recommended size of {max_rec_mb} " + f"[WARNING] Generating with a model that requires {model_mb} MB " + f"which is close to the maximum recommended size of {max_rec_mb} " "MB. This can be slow. See the documentation for possible work-arounds: " "https://github.com/ml-explore/mlx-examples/tree/main/llms#large-models" ) From 60c7b803500df4dd84ef8b5ed70deace99272bc2 Mon Sep 17 00:00:00 2001 From: Valentin Roussellet Date: Wed, 20 Nov 2024 15:21:52 -0800 Subject: [PATCH 2/3] Pass seed to sd img2img (#1114) --- stable_diffusion/image2image.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stable_diffusion/image2image.py b/stable_diffusion/image2image.py index e470aa81..a037af6a 100644 --- a/stable_diffusion/image2image.py +++ b/stable_diffusion/image2image.py @@ -30,6 +30,7 @@ if __name__ == "__main__": parser.add_argument("--preload-models", action="store_true") parser.add_argument("--output", default="out.png") parser.add_argument("--verbose", "-v", action="store_true") + parser.add_argument("--seed", type=int) args = parser.parse_args() # Load the models @@ -94,6 +95,7 @@ if __name__ == "__main__": cfg_weight=args.cfg, num_steps=args.steps, negative_text=args.negative_prompt, + seed=args.seed ) for x_t in tqdm(latents, total=int(args.steps * args.strength)): mx.eval(x_t) From 042280ce50645b69d9c322ccf1cb8471384007f1 Mon Sep 17 00:00:00 2001 From: Angelos Katharopoulos Date: Wed, 20 Nov 2024 16:15:53 -0800 Subject: [PATCH 3/3] Fix format (#1115) --- stable_diffusion/image2image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stable_diffusion/image2image.py b/stable_diffusion/image2image.py index a037af6a..4444c488 100644 --- a/stable_diffusion/image2image.py +++ b/stable_diffusion/image2image.py @@ -95,7 +95,7 @@ if __name__ == "__main__": cfg_weight=args.cfg, num_steps=args.steps, negative_text=args.negative_prompt, - seed=args.seed + seed=args.seed, ) for x_t in tqdm(latents, total=int(args.steps * args.strength)): mx.eval(x_t)