@@ -124,71 +124,6 @@ def tearDown(self):
124124        gc .collect ()
125125        torch .cuda .empty_cache ()
126126
127-     def  test_sdxl_0_9_lora_one (self ):
128-         generator  =  torch .Generator ().manual_seed (0 )
129- 
130-         pipe  =  StableDiffusionXLPipeline .from_pretrained ("stabilityai/stable-diffusion-xl-base-0.9" )
131-         lora_model_id  =  "hf-internal-testing/sdxl-0.9-daiton-lora" 
132-         lora_filename  =  "daiton-xl-lora-test.safetensors" 
133-         pipe .load_lora_weights (lora_model_id , weight_name = lora_filename )
134-         pipe .enable_model_cpu_offload ()
135- 
136-         images  =  pipe (
137-             "masterpiece, best quality, mountain" , output_type = "np" , generator = generator , num_inference_steps = 2 
138-         ).images 
139- 
140-         images  =  images [0 , - 3 :, - 3 :, - 1 ].flatten ()
141-         expected  =  np .array ([0.3838 , 0.3482 , 0.3588 , 0.3162 , 0.319 , 0.3369 , 0.338 , 0.3366 , 0.3213 ])
142- 
143-         max_diff  =  numpy_cosine_similarity_distance (expected , images )
144-         assert  max_diff  <  1e-3 
145-         pipe .unload_lora_weights ()
146-         release_memory (pipe )
147- 
148-     def  test_sdxl_0_9_lora_two (self ):
149-         generator  =  torch .Generator ().manual_seed (0 )
150- 
151-         pipe  =  StableDiffusionXLPipeline .from_pretrained ("stabilityai/stable-diffusion-xl-base-0.9" )
152-         lora_model_id  =  "hf-internal-testing/sdxl-0.9-costumes-lora" 
153-         lora_filename  =  "saijo.safetensors" 
154-         pipe .load_lora_weights (lora_model_id , weight_name = lora_filename )
155-         pipe .enable_model_cpu_offload ()
156- 
157-         images  =  pipe (
158-             "masterpiece, best quality, mountain" , output_type = "np" , generator = generator , num_inference_steps = 2 
159-         ).images 
160- 
161-         images  =  images [0 , - 3 :, - 3 :, - 1 ].flatten ()
162-         expected  =  np .array ([0.3137 , 0.3269 , 0.3355 , 0.255 , 0.2577 , 0.2563 , 0.2679 , 0.2758 , 0.2626 ])
163- 
164-         max_diff  =  numpy_cosine_similarity_distance (expected , images )
165-         assert  max_diff  <  1e-3 
166- 
167-         pipe .unload_lora_weights ()
168-         release_memory (pipe )
169- 
170-     def  test_sdxl_0_9_lora_three (self ):
171-         generator  =  torch .Generator ().manual_seed (0 )
172- 
173-         pipe  =  StableDiffusionXLPipeline .from_pretrained ("stabilityai/stable-diffusion-xl-base-0.9" )
174-         lora_model_id  =  "hf-internal-testing/sdxl-0.9-kamepan-lora" 
175-         lora_filename  =  "kame_sdxl_v2-000020-16rank.safetensors" 
176-         pipe .load_lora_weights (lora_model_id , weight_name = lora_filename )
177-         pipe .enable_model_cpu_offload ()
178- 
179-         images  =  pipe (
180-             "masterpiece, best quality, mountain" , output_type = "np" , generator = generator , num_inference_steps = 2 
181-         ).images 
182- 
183-         images  =  images [0 , - 3 :, - 3 :, - 1 ].flatten ()
184-         expected  =  np .array ([0.4015 , 0.3761 , 0.3616 , 0.3745 , 0.3462 , 0.3337 , 0.3564 , 0.3649 , 0.3468 ])
185- 
186-         max_diff  =  numpy_cosine_similarity_distance (expected , images )
187-         assert  max_diff  <  5e-3 
188- 
189-         pipe .unload_lora_weights ()
190-         release_memory (pipe )
191- 
192127    def  test_sdxl_1_0_lora (self ):
193128        generator  =  torch .Generator ("cpu" ).manual_seed (0 )
194129
0 commit comments