Skip to content

Commit

Permalink
[Fix] Revise metafile for sd-inpainting to fix inferencer init (#1995)
Browse files Browse the repository at this point in the history
* revise metafile for sd-inpainting to fix inferencer init

* revise README and task parsing logic in update_model_index.py
  • Loading branch information
LeoXing1996 authored Aug 22, 2023
1 parent a06fb3b commit ffb2bc4
Show file tree
Hide file tree
Showing 11 changed files with 417 additions and 403 deletions.
18 changes: 16 additions & 2 deletions .dev_scripts/update_model_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,13 @@ def parse_md(md_file):
year = int(re.sub('[^0-9]', '', year))
collection_name = name.strip()
task_line = lines[4]
task = task_line.strip().split(':')[-1].strip()
model_task = task_line.strip().split(':')[-1].strip()
model_task_list = model_task.lower().split(', ')

collection.name = collection_name
collection.readme = readme
collection.data['Year'] = year
collection.data['Task'] = task.lower().split(', ')
collection.data['Task'] = model_task_list
collection_meta.architecture = [collection_name]

i = 0
Expand All @@ -149,6 +150,10 @@ def parse_md(md_file):
dataset_idx = cols.index('Dataset')
download_idx = cols.index('Download')
used_metrics = collate_metrics(cols)
if 'Task' in cols:
task_idx = cols.index('Task')
else:
task_idx = None
except Exception:
raise ValueError(
f'required fields: Model, Dataset, Download '
Expand Down Expand Up @@ -196,6 +201,15 @@ def parse_md(md_file):
except ValueError:
pass

task = model_task if task_idx is None else line[
task_idx].strip()
assert ',' not in task, (
f'Find "," in "task" field of "{md_file}" (line {j}). '
'Please check your readme carefully.')
assert task.lower() in model_task_list, (
f'Task "{task}" not in "{model_task_list}" in "{md_file}" '
f'(line {j}). Please check your readme carefully.')

result = Result(task=task, dataset=dataset, metrics=metrics)
if model.results is None:
model.results = result
Expand Down
10 changes: 5 additions & 5 deletions configs/disco_diffusion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ Created by Somnai, augmented by Gandamu, and building on the work of RiversHaveW

We have converted several `unet` weights and offer related configs. See more details of different `unet` in [Tutorial](#tutorials).

| Model | Dataset | Download |
| :--------------------------------------------------------------------------------------------: | :------: | :------------------------------------------------------------------------------------------------: |
| [512x512_diffusion_uncond_finetune_008100](./disco-diffusion_adm-u-finetuned_imagenet-512x512.py) | ImageNet | [model](https://download.openmmlab.com/mmediting/synthesizers/disco/adm-u_finetuned_imagenet-512x512-ab471d70.pth) |
| [256x256_diffusion_uncond](./disco-diffusion_adm-u-finetuned_imagenet-256x256.py) | ImageNet | [model](<>) |
| [portrait_generator_v001](./disco-diffusion_portrait-generator-v001.py) | unknown | [model](https://download.openmmlab.com/mmediting/synthesizers/disco/adm-u-cvt-rgb_portrait-v001-f4a3f3bc.pth) |
| Model | Dataset | Task | Download |
| :---------------------------------------------------------------------------------------: | :------: | :--------: | :-------------------------------------------------------------------------------------------: |
| [512x512_diffusion_uncond_finetune_008100](./disco-diffusion_adm-u-finetuned_imagenet-512x512.py) | ImageNet | Text2Image | [model](https://download.openmmlab.com/mmediting/synthesizers/disco/adm-u_finetuned_imagenet-512x512-ab471d70.pth) |
| [256x256_diffusion_uncond](./disco-diffusion_adm-u-finetuned_imagenet-256x256.py) | ImageNet | Text2Image | [model](<>) |
| [portrait_generator_v001](./disco-diffusion_portrait-generator-v001.py) | unknown | Text2Image | [model](https://download.openmmlab.com/mmediting/synthesizers/disco/adm-u-cvt-rgb_portrait-v001-f4a3f3bc.pth) |

<!-- SKIP THIS TABLE -->

Expand Down
6 changes: 3 additions & 3 deletions configs/disco_diffusion/metafile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ Models:
Results:
- Dataset: ImageNet
Metrics: {}
Task: Text2Image, Image2Image
Task: Text2Image
Weights: https://download.openmmlab.com/mmediting/synthesizers/disco/adm-u_finetuned_imagenet-512x512-ab471d70.pth
- Config: configs/disco_diffusion/disco-diffusion_adm-u-finetuned_imagenet-256x256.py
In Collection: Disco Diffusion
Name: disco-diffusion_adm-u-finetuned_imagenet-256x256
Results:
- Dataset: ImageNet
Metrics: {}
Task: Text2Image, Image2Image
Task: Text2Image
Weights: <>
- Config: configs/disco_diffusion/disco-diffusion_portrait-generator-v001.py
In Collection: Disco Diffusion
Name: disco-diffusion_portrait-generator-v001
Results:
- Dataset: unknown
Metrics: {}
Task: Text2Image, Image2Image
Task: Text2Image
Weights: https://download.openmmlab.com/mmediting/synthesizers/disco/adm-u-cvt-rgb_portrait-v001-f4a3f3bc.pth
Loading

0 comments on commit ffb2bc4

Please sign in to comment.