Skip to content

Commit

Permalink
Add kolors eval
Browse files Browse the repository at this point in the history
  • Loading branch information
lixiang007666 committed Jul 20, 2024
1 parent 0d56572 commit 3b942b5
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion metrics/fid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
from T2IBenchmark.datasets import get_coco_fid_stats

fid, _ = calculate_fid(
'output_images',
'/home/lixiang/data/fid_kolors_nexfort',
get_coco_fid_stats()
)
18 changes: 18 additions & 0 deletions models/kolors/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Using onediff to accelerate the quality evaluation of kolors.


## Qualitative evaluation

We used several typical prompts to visualize generated images, proving that the compilation acceleration of onediff is almost lossless.

| Prompt | Reference Image | OnFlow Backend | NexFort Backend |
|--------|-----------------|----------------|-----------------|
| 穿着黑色T恤的可爱小狗,T恤上面中文绿色大字写着“可图”。 | <img src="./asset/kolors_01.png" width="150px"> | <img src="./asset/kolors_oneflow_compile_01.png" width="150px"> | <img src="./asset/kolors_nexfort_compile_01.png" width="150px"> |
| 一张兔子的特写照片,春天的森林中,有雾、晕影、开花、戏剧性的氛围,以三分法为中心,200mm 1.4f的微距镜头拍摄。 | <img src="./asset/kolors_02.png" width="150px"> | <img src="./asset/kolors_oneflow_compile_02.png" width="150px"> | <img src="./asset/kolors_nexfort_compile_02.png" width="150px"> |
| 一条繁忙的街道,车辆在两个方向上行驶,街道上有几辆双层巴士和周围的人们。 | <img src="./asset/kolors_03.png" width="150px"> | <img src="./asset/kolors_oneflow_compile_03.png" width="150px"> | <img src="./asset/kolors_nexfort_compile_03.png" width="150px"> |
| 动漫风格,一名女孩在室内,坐在客厅的沙发上,拥有粉红色的头发、白色的袜子、蓝色的眼睛,从背后、从上方看,面向观众,正在玩视频游戏,手持控制器,穿着黑色丝绸,嘴唇微张。 | <img src="./asset/kolors_04.png" width="150px"> | <img src="./asset/kolors_oneflow_compile_04.png" width="150px"> | <img src="./asset/kolors_nexfort_compile_04.png" width="150px"> |
| 一张年轻中国女性在公园的肖像照片。她的长黑发轻轻飘动。背景中柔和的樱花粉增添了画面的美感。 | <img src="./asset/kolors_05.png" width="150px"> | <img src="./asset/kolors_oneflow_compile_05.png" width="150px"> | <img src="./asset/kolors_nexfort_compile_05.png" width="150px"> |



## Quantitative evaluation
Binary file added models/kolors/asset/kolors_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/kolors/asset/kolors_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/kolors/asset/kolors_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/kolors/asset/kolors_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/kolors/asset/kolors_05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/kolors/asset/kolors_nexfort_compile_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/kolors/asset/kolors_nexfort_compile_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/kolors/asset/kolors_nexfort_compile_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/kolors/asset/kolors_nexfort_compile_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/kolors/asset/kolors_nexfort_compile_05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/kolors/asset/kolors_oneflow_compile_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/kolors/asset/kolors_oneflow_compile_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/kolors/asset/kolors_oneflow_compile_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added models/kolors/asset/kolors_oneflow_compile_05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions models/kolors/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,13 @@ def main():
}

kolors.warmup(gen_args, args.warmup_iterations)
# torch.cuda.empty_cache()

for idx, prompt in enumerate(prompts):
gen_args["prompt"] = prompt
output_path = os.path.join(args.output_dir, f"image_{idx+1}.png")
image, inference_time = kolors.generate(gen_args, output_path)
# torch.cuda.empty_cache()
print(f"Generated image saved to {output_path} in {inference_time:.2f} seconds.")
cuda_mem_after_used = torch.cuda.max_memory_allocated() / (1024 ** 3)
print(f"Max used CUDA memory: {cuda_mem_after_used:.3f} GiB")
Expand Down

0 comments on commit 3b942b5

Please sign in to comment.