diffeval 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- diffeval-0.1.0/LICENSE +190 -0
- diffeval-0.1.0/PKG-INFO +378 -0
- diffeval-0.1.0/README.md +339 -0
- diffeval-0.1.0/pyproject.toml +48 -0
- diffeval-0.1.0/setup.cfg +4 -0
- diffeval-0.1.0/src/diffeval/__init__.py +7 -0
- diffeval-0.1.0/src/diffeval/__main__.py +6 -0
- diffeval-0.1.0/src/diffeval/aggregate/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/aggregate/mean.py +7 -0
- diffeval-0.1.0/src/diffeval/aggregate/names.py +11 -0
- diffeval-0.1.0/src/diffeval/aggregate/row.py +26 -0
- diffeval-0.1.0/src/diffeval/aggregate/sample_std.py +9 -0
- diffeval-0.1.0/src/diffeval/aggregate/series.py +22 -0
- diffeval-0.1.0/src/diffeval/aggregate/table.py +8 -0
- diffeval-0.1.0/src/diffeval/backends/__init__.py +4 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/attention_apply.py +16 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/attention_eager.py +6 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/attention_name.py +15 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/attention_sdpa.py +6 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/attention_xformers.py +5 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/backend.py +29 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/call_kwargs.py +15 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/coerce_dtype.py +10 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/describe.py +6 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/dtype_name.py +23 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/from_config.py +17 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/generate.py +18 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/kwargs_generator.py +6 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/kwargs_prompt.py +11 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/kwargs_sampling.py +18 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/kwargs_size.py +18 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/load_kwargs.py +10 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/load_pipe.py +23 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/missing_dep.py +10 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/one_batch.py +11 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/pick_device.py +13 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/presets.py +8 -0
- diffeval-0.1.0/src/diffeval/backends/diffusers/sampling.py +18 -0
- diffeval-0.1.0/src/diffeval/backends/dummy/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/backends/dummy/backend.py +29 -0
- diffeval-0.1.0/src/diffeval/backends/dummy/box.py +9 -0
- diffeval-0.1.0/src/diffeval/backends/dummy/colors.py +10 -0
- diffeval-0.1.0/src/diffeval/backends/dummy/describe.py +18 -0
- diffeval-0.1.0/src/diffeval/backends/dummy/draw.py +16 -0
- diffeval-0.1.0/src/diffeval/backends/dummy/from_config.py +14 -0
- diffeval-0.1.0/src/diffeval/backends/dummy/generate.py +17 -0
- diffeval-0.1.0/src/diffeval/backends/dummy/render.py +18 -0
- diffeval-0.1.0/src/diffeval/backends/noop_prepare.py +5 -0
- diffeval-0.1.0/src/diffeval/backends/protocol.py +15 -0
- diffeval-0.1.0/src/diffeval/bench/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/bench/cmmd_check.py +20 -0
- diffeval-0.1.0/src/diffeval/bench/cmmd_samples.py +15 -0
- diffeval-0.1.0/src/diffeval/bench/coco30k_cli.py +23 -0
- diffeval-0.1.0/src/diffeval/bench/coco30k_export.py +19 -0
- diffeval-0.1.0/src/diffeval/bench/coco30k_files.py +16 -0
- diffeval-0.1.0/src/diffeval/bench/coco30k_images.py +21 -0
- diffeval-0.1.0/src/diffeval/bench/coco30k_suite.py +16 -0
- diffeval-0.1.0/src/diffeval/bench/fetch.py +12 -0
- diffeval-0.1.0/src/diffeval/bench/published.py +10 -0
- diffeval-0.1.0/src/diffeval/bench/table_cli.py +16 -0
- diffeval-0.1.0/src/diffeval/bench/table_row.py +24 -0
- diffeval-0.1.0/src/diffeval/cli/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/cli/command_list.py +13 -0
- diffeval-0.1.0/src/diffeval/cli/command_run.py +25 -0
- diffeval-0.1.0/src/diffeval/cli/config.py +14 -0
- diffeval-0.1.0/src/diffeval/cli/csv_ints.py +8 -0
- diffeval-0.1.0/src/diffeval/cli/csv_names.py +8 -0
- diffeval-0.1.0/src/diffeval/cli/main.py +12 -0
- diffeval-0.1.0/src/diffeval/cli/output_dir.py +12 -0
- diffeval-0.1.0/src/diffeval/cli/parser.py +17 -0
- diffeval-0.1.0/src/diffeval/cli/print_paths.py +12 -0
- diffeval-0.1.0/src/diffeval/cli/print_registered.py +6 -0
- diffeval-0.1.0/src/diffeval/cli/run_parser_eval.py +14 -0
- diffeval-0.1.0/src/diffeval/cli/run_parser_model.py +13 -0
- diffeval-0.1.0/src/diffeval/metrics/__init__.py +7 -0
- diffeval-0.1.0/src/diffeval/metrics/clip/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/metrics/clip/features.py +14 -0
- diffeval-0.1.0/src/diffeval/metrics/clip/formula.py +6 -0
- diffeval-0.1.0/src/diffeval/metrics/clip/load.py +17 -0
- diffeval-0.1.0/src/diffeval/metrics/clip/metric.py +20 -0
- diffeval-0.1.0/src/diffeval/metrics/clip/protocol.py +10 -0
- diffeval-0.1.0/src/diffeval/metrics/clip/sample_image.py +10 -0
- diffeval-0.1.0/src/diffeval/metrics/clip/score.py +25 -0
- diffeval-0.1.0/src/diffeval/metrics/cmmd/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/metrics/cmmd/embed_batch.py +26 -0
- diffeval-0.1.0/src/diffeval/metrics/cmmd/embed_paths.py +30 -0
- diffeval-0.1.0/src/diffeval/metrics/cmmd/metric.py +20 -0
- diffeval-0.1.0/src/diffeval/metrics/cmmd/mmd.py +23 -0
- diffeval-0.1.0/src/diffeval/metrics/cmmd/protocol.py +11 -0
- diffeval-0.1.0/src/diffeval/metrics/cmmd/resize.py +17 -0
- diffeval-0.1.0/src/diffeval/metrics/cmmd/score.py +24 -0
- diffeval-0.1.0/src/diffeval/metrics/count_warning.py +7 -0
- diffeval-0.1.0/src/diffeval/metrics/distribution/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/metrics/distribution/call.py +24 -0
- diffeval-0.1.0/src/diffeval/metrics/distribution/kwargs_folder.py +16 -0
- diffeval-0.1.0/src/diffeval/metrics/distribution/kwargs_stats.py +8 -0
- diffeval-0.1.0/src/diffeval/metrics/distribution/protocol.py +12 -0
- diffeval-0.1.0/src/diffeval/metrics/distribution/seed_numpy.py +12 -0
- diffeval-0.1.0/src/diffeval/metrics/fid/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/metrics/fid/guard.py +13 -0
- diffeval-0.1.0/src/diffeval/metrics/fid/metric.py +20 -0
- diffeval-0.1.0/src/diffeval/metrics/geneval/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/metrics/geneval/metric.py +22 -0
- diffeval-0.1.0/src/diffeval/metrics/geneval/protocol.py +5 -0
- diffeval-0.1.0/src/diffeval/metrics/geneval/tags.py +3 -0
- diffeval-0.1.0/src/diffeval/metrics/images.py +12 -0
- diffeval-0.1.0/src/diffeval/metrics/kid/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/metrics/kid/guard.py +3 -0
- diffeval-0.1.0/src/diffeval/metrics/kid/metric.py +20 -0
- diffeval-0.1.0/src/diffeval/metrics/ok.py +9 -0
- diffeval-0.1.0/src/diffeval/metrics/protocol.py +17 -0
- diffeval-0.1.0/src/diffeval/metrics/skipped.py +10 -0
- diffeval-0.1.0/src/diffeval/plugins.py +7 -0
- diffeval-0.1.0/src/diffeval/registry/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/registry/lookup.py +9 -0
- diffeval-0.1.0/src/diffeval/registry/names.py +5 -0
- diffeval-0.1.0/src/diffeval/registry/register.py +11 -0
- diffeval-0.1.0/src/diffeval/registry/tables.py +5 -0
- diffeval-0.1.0/src/diffeval/registry/unregister.py +5 -0
- diffeval-0.1.0/src/diffeval/report/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/report/console.py +18 -0
- diffeval-0.1.0/src/diffeval/report/console_widths.py +5 -0
- diffeval-0.1.0/src/diffeval/report/direction.py +7 -0
- diffeval-0.1.0/src/diffeval/report/html_figure.py +9 -0
- diffeval-0.1.0/src/diffeval/report/html_grid.py +19 -0
- diffeval-0.1.0/src/diffeval/report/html_page.py +15 -0
- diffeval-0.1.0/src/diffeval/report/html_row.py +12 -0
- diffeval-0.1.0/src/diffeval/report/markdown.py +11 -0
- diffeval-0.1.0/src/diffeval/report/markdown_row.py +10 -0
- diffeval-0.1.0/src/diffeval/report/number.py +7 -0
- diffeval-0.1.0/src/diffeval/report/templates/page.html +35 -0
- diffeval-0.1.0/src/diffeval/runner/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/runner/generate_save.py +19 -0
- diffeval-0.1.0/src/diffeval/runner/metric_device.py +16 -0
- diffeval-0.1.0/src/diffeval/runner/one_seed.py +20 -0
- diffeval-0.1.0/src/diffeval/runner/options.py +23 -0
- diffeval-0.1.0/src/diffeval/runner/payload.py +26 -0
- diffeval-0.1.0/src/diffeval/runner/relpath.py +7 -0
- diffeval-0.1.0/src/diffeval/runner/requests.py +7 -0
- diffeval-0.1.0/src/diffeval/runner/run.py +24 -0
- diffeval-0.1.0/src/diffeval/runner/safe_metric.py +14 -0
- diffeval-0.1.0/src/diffeval/runner/save_png.py +8 -0
- diffeval-0.1.0/src/diffeval/runner/seeds.py +23 -0
- diffeval-0.1.0/src/diffeval/runner/write_json.py +11 -0
- diffeval-0.1.0/src/diffeval/runner/write_reports.py +14 -0
- diffeval-0.1.0/src/diffeval/system/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/system/describe.py +10 -0
- diffeval-0.1.0/src/diffeval/system/gpu.py +11 -0
- diffeval-0.1.0/src/diffeval/system/gpu_cuda.py +9 -0
- diffeval-0.1.0/src/diffeval/system/gpu_mps.py +8 -0
- diffeval-0.1.0/src/diffeval/system/sdp_flags.py +15 -0
- diffeval-0.1.0/src/diffeval/system/version_of.py +10 -0
- diffeval-0.1.0/src/diffeval/system/versions.py +20 -0
- diffeval-0.1.0/src/diffeval/tasks/__init__.py +3 -0
- diffeval-0.1.0/src/diffeval/tasks/build_suite.py +7 -0
- diffeval-0.1.0/src/diffeval/tasks/core.py +15 -0
- diffeval-0.1.0/src/diffeval/tasks/errors.py +5 -0
- diffeval-0.1.0/src/diffeval/tasks/fields_metrics.py +14 -0
- diffeval-0.1.0/src/diffeval/tasks/fields_paths.py +25 -0
- diffeval-0.1.0/src/diffeval/tasks/fields_prompts.py +15 -0
- diffeval-0.1.0/src/diffeval/tasks/fields_seeds.py +14 -0
- diffeval-0.1.0/src/diffeval/tasks/fields_size.py +12 -0
- diffeval-0.1.0/src/diffeval/tasks/fields_text.py +13 -0
- diffeval-0.1.0/src/diffeval/tasks/from_mapping.py +22 -0
- diffeval-0.1.0/src/diffeval/tasks/load_bundled.py +9 -0
- diffeval-0.1.0/src/diffeval/tasks/load_path.py +12 -0
- diffeval-0.1.0/src/diffeval/tasks/one_prompt.py +17 -0
- diffeval-0.1.0/src/diffeval/tasks/prompt_id.py +13 -0
- diffeval-0.1.0/src/diffeval/tasks/read_yaml.py +14 -0
- diffeval-0.1.0/src/diffeval/tasks/resolve.py +18 -0
- diffeval-0.1.0/src/diffeval/tasks/suites/core.yaml +12 -0
- diffeval-0.1.0/src/diffeval/tasks/suites/references/core/blue_sphere.png +0 -0
- diffeval-0.1.0/src/diffeval/tasks/suites/references/core/green_triangle.png +0 -0
- diffeval-0.1.0/src/diffeval/tasks/suites/references/core/red_cube.png +0 -0
- diffeval-0.1.0/src/diffeval/tasks/suites/references/core/yellow_star.png +0 -0
- diffeval-0.1.0/src/diffeval/types/__init__.py +1 -0
- diffeval-0.1.0/src/diffeval/types/context.py +15 -0
- diffeval-0.1.0/src/diffeval/types/prompt.py +10 -0
- diffeval-0.1.0/src/diffeval/types/request.py +13 -0
- diffeval-0.1.0/src/diffeval/types/result.py +14 -0
- diffeval-0.1.0/src/diffeval/types/result_rules.py +13 -0
- diffeval-0.1.0/src/diffeval/types/sample.py +15 -0
- diffeval-0.1.0/src/diffeval/types/suite.py +21 -0
- diffeval-0.1.0/src/diffeval.egg-info/PKG-INFO +378 -0
- diffeval-0.1.0/src/diffeval.egg-info/SOURCES.txt +189 -0
- diffeval-0.1.0/src/diffeval.egg-info/dependency_links.txt +1 -0
- diffeval-0.1.0/src/diffeval.egg-info/entry_points.txt +6 -0
- diffeval-0.1.0/src/diffeval.egg-info/requires.txt +27 -0
- diffeval-0.1.0/src/diffeval.egg-info/top_level.txt +1 -0
- diffeval-0.1.0/tests/test_version.py +7 -0
diffeval-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 woletee
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
diffeval-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: diffeval
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Evaluation harness for image and video diffusion models
|
|
5
|
+
Author: woletee
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Keywords: diffusion,evaluation,benchmark,text-to-image,fid,kid,cmmd,clip-score
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: pyyaml
|
|
18
|
+
Requires-Dist: pillow
|
|
19
|
+
Requires-Dist: numpy
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
22
|
+
Provides-Extra: diffusers
|
|
23
|
+
Requires-Dist: torch; extra == "diffusers"
|
|
24
|
+
Requires-Dist: diffusers; extra == "diffusers"
|
|
25
|
+
Requires-Dist: transformers; extra == "diffusers"
|
|
26
|
+
Requires-Dist: accelerate; extra == "diffusers"
|
|
27
|
+
Requires-Dist: safetensors; extra == "diffusers"
|
|
28
|
+
Provides-Extra: metrics
|
|
29
|
+
Requires-Dist: torch; extra == "metrics"
|
|
30
|
+
Requires-Dist: transformers; extra == "metrics"
|
|
31
|
+
Requires-Dist: clean-fid; extra == "metrics"
|
|
32
|
+
Requires-Dist: scipy<1.18; extra == "metrics"
|
|
33
|
+
Provides-Extra: benchmarks
|
|
34
|
+
Requires-Dist: pyarrow; extra == "benchmarks"
|
|
35
|
+
Requires-Dist: huggingface_hub; extra == "benchmarks"
|
|
36
|
+
Provides-Extra: geneval
|
|
37
|
+
Provides-Extra: video
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
<div align="center">
|
|
41
|
+
|
|
42
|
+
<picture>
|
|
43
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/woletee/diffeval/main/docs/assets/logo-dark.svg">
|
|
44
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/woletee/diffeval/main/docs/assets/logo-light.svg">
|
|
45
|
+
<img alt="diffeval" src="https://raw.githubusercontent.com/woletee/diffeval/main/docs/assets/logo-light.svg" width="240">
|
|
46
|
+
</picture>
|
|
47
|
+
|
|
48
|
+
# diffeval: A Framework for Diffusion Model Evaluation
|
|
49
|
+
|
|
50
|
+
A fixed prompt and seed suite, scored the same way on every model.
|
|
51
|
+
|
|
52
|
+
[](https://github.com/woletee/diffeval/actions/workflows/ci.yml)
|
|
53
|
+
[](https://github.com/woletee/diffeval/blob/main/pyproject.toml)
|
|
54
|
+
[](https://github.com/woletee/diffeval/blob/main/LICENSE)
|
|
55
|
+
|
|
56
|
+
<p>
|
|
57
|
+
<a href="#quickstart">Quickstart</a>
|
|
58
|
+
·
|
|
59
|
+
<a href="#metrics">Metrics</a>
|
|
60
|
+
·
|
|
61
|
+
<a href="#backends">Backends</a>
|
|
62
|
+
·
|
|
63
|
+
<a href="#suites">Suites</a>
|
|
64
|
+
·
|
|
65
|
+
<a href="#extending-diffeval">Extending</a>
|
|
66
|
+
·
|
|
67
|
+
<a href="docs/DESIGN.md">Design</a>
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
diffeval is an evaluation harness for image and video diffusion models, in the same role [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness) has for language models. You name a backend and a suite. The suite fixes the prompts, the seeds, and the resolution. For each seed the backend writes one image per prompt, every metric scores that seed, and the runner aggregates a mean and a sample standard deviation. The run writes a console table, `results.json`, `report.md`, and `report.html`.
|
|
73
|
+
|
|
74
|
+
Video scoring is later. This version scores images. The `video` extra installs no packages, and there is no `vbench` metric.
|
|
75
|
+
|
|
76
|
+
- **Pluggable.** Suites, metrics, and backends register by name. `diffeval list` and `diffeval run` look names up in `TASKS`, `METRICS`, and `BACKENDS`.
|
|
77
|
+
- **Light by default.** The base install is PyYAML, Pillow, and NumPy. Torch, Diffusers, and clean-fid stay in optional extras.
|
|
78
|
+
- **Honest scores.** A missing library or a missing reference is status `skipped`, with the reason stored on the row. The images stay on disk.
|
|
79
|
+
- **Traceable.** `results.json` uses `schema_version` 1. It stores the suite, `describe()`, package versions, the GPU when torch reports one, and `metric_protocols`.
|
|
80
|
+
|
|
81
|
+
> [!NOTE]
|
|
82
|
+
> diffeval publishes no benchmark numbers. The bundled `core` suite is a smoke check. The `diffusers` backend has not been validated on a GPU in this repository. Compare a score with a paper only after matching that paper's reference implementation and dataset.
|
|
83
|
+
|
|
84
|
+
## Installation
|
|
85
|
+
|
|
86
|
+
diffeval requires Python 3.10 or newer.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pip install diffeval
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Add extras in brackets, for example `pip install "diffeval[diffusers,metrics]"`. To work on the code, clone the repository and run `pip install -e ".[dev]"`.
|
|
93
|
+
|
|
94
|
+
That installs the CLI, the YAML loader, Pillow, and NumPy.
|
|
95
|
+
|
|
96
|
+
| Extra | Installs | Used for |
|
|
97
|
+
| --- | --- | --- |
|
|
98
|
+
| `diffusers` | torch, diffusers, transformers, accelerate, safetensors | the `diffusers` backend |
|
|
99
|
+
| `metrics` | torch, transformers, clean-fid, scipy<1.18 | `clip_score`, `cmmd`, `fid`, `kid` |
|
|
100
|
+
| `benchmarks` | pyarrow, huggingface_hub | `diffeval-coco30k-images` |
|
|
101
|
+
| `dev` | pytest | the tests |
|
|
102
|
+
| `geneval` | nothing | keeps the GenEval detector off the default install |
|
|
103
|
+
| `video` | nothing | keeps VBench off the default install |
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pip install -e ".[diffusers,metrics]"
|
|
107
|
+
pip install -e ".[dev]"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The `geneval` metric returns `skipped`. The `video` extra does not install VBench.
|
|
111
|
+
|
|
112
|
+
## Quickstart
|
|
113
|
+
|
|
114
|
+
Start with a CPU smoke run. The `dummy` backend draws deterministic RGB images, so the command downloads nothing.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
diffeval run --backend dummy --suite core
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
If you omit both `--backend` and `--pipeline`, the backend is `dummy`. `--pipeline` without `--backend` selects `diffusers`.
|
|
121
|
+
|
|
122
|
+
Then a Diffusers model. Install the `diffusers` extra first. The command downloads weights. It has not been run in this repository, and CI does not run it. Without the extra, the process prints `install the diffusers extra: pip install 'diffeval[diffusers]'` and exits 2.
|
|
123
|
+
|
|
124
|
+
One smaller model has been run on a CPU. `stabilityai/sd-turbo` with `--steps 1 --guidance 0 --device cpu` generated all eight `core` images and scored `clip_score`, `cmmd`, `fid`, and `kid`, at about five seconds per image. That run says the backend and metrics work end to end. Its scores against the four `core` drawings are not quality numbers.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
diffeval run --pipeline stabilityai/sd-turbo --suite core --steps 1 --guidance 0 --device cpu
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
diffeval run --pipeline black-forest-labs/FLUX.1-schnell --suite core
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
When `--steps` and `--guidance` are omitted, `black-forest-labs/FLUX.1-schnell` uses 4 steps and guidance 0. Any other model id leaves the pipeline defaults in place. A value passed on the CLI wins.
|
|
135
|
+
|
|
136
|
+
Each run writes a directory. The default is `outputs/<UTC timestamp>-<suite>-<backend>`. The timestamp looks like `20261025T153000Z`. Spaces and slashes in that label become underscores. The model id stays in `describe()`. The folder name ends with the backend, `dummy` or `diffusers`.
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
outputs/20261025T153000Z-core-dummy/
|
|
140
|
+
├── images/
|
|
141
|
+
│ ├── seed_0/red_cube.png
|
|
142
|
+
│ └── seed_1/red_cube.png
|
|
143
|
+
├── results.json
|
|
144
|
+
├── report.md
|
|
145
|
+
└── report.html
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
`core` has four prompts, so each seed directory holds four PNGs. Paths inside `results.json` are relative to the output directory, for example `images/seed_0/red_cube.png`.
|
|
149
|
+
|
|
150
|
+
The console table and `report.md` have one row per metric. Columns are metric, status, mean, std, per-seed, and direction. With only the base install, the metrics are `skipped`:
|
|
151
|
+
|
|
152
|
+
```text
|
|
153
|
+
metric status mean std per-seed direction
|
|
154
|
+
clip_score skipped n/a n/a n/a,n/a higher
|
|
155
|
+
cmmd skipped n/a n/a n/a,n/a lower
|
|
156
|
+
fid skipped n/a n/a n/a,n/a lower
|
|
157
|
+
kid skipped n/a n/a n/a,n/a lower
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Mean is the arithmetic mean of seeds whose status is `ok`. Standard deviation is the sample standard deviation, `ddof=1`. It is null when fewer than two seeds succeeded, and the console prints that null as `n/a`. The row stores `std_ddof` as 1. `core` uses two seeds so a real metric can show a standard deviation.
|
|
161
|
+
|
|
162
|
+
`report.html` repeats the table and shows an image grid grouped by prompt, one figure per seed. Prompts are escaped. The page says to check scores against the published reference implementation and dataset, and it calls `core` a smoke suite.
|
|
163
|
+
|
|
164
|
+
Exit code 0 means the report was written. Exit code 2 means the suite, backend, or metric name was unknown, generation failed, the chosen backend's extra is missing, or `--strict` found a metric that is not `ok`. `--strict` is off by default. The runner writes the report first, then exits 2. A smoke run with the metrics extra missing still exits 0.
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
diffeval list tasks
|
|
168
|
+
diffeval list metrics
|
|
169
|
+
diffeval list backends
|
|
170
|
+
diffeval run --backend dummy --suite core --seeds 0 --output outputs/smoke
|
|
171
|
+
diffeval run --backend dummy --suite core --metrics geneval --strict
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The last command writes the report and exits 2. `geneval` is skipped, and `--strict` requires every aggregate status to be `ok`.
|
|
175
|
+
|
|
176
|
+
## Command reference
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
diffeval list tasks
|
|
180
|
+
diffeval list metrics
|
|
181
|
+
diffeval list backends
|
|
182
|
+
diffeval run --suite NAME_OR_PATH [options]
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
| Option | Description |
|
|
186
|
+
| --- | --- |
|
|
187
|
+
| `--suite` | A registered suite name, or a path ending in `.yaml` or `.yml`. Required. A bare name is looked up in `TASKS`. |
|
|
188
|
+
| `--backend` | `dummy` or `diffusers`. Defaults to `diffusers` when `--pipeline` is set, otherwise `dummy`. |
|
|
189
|
+
| `--pipeline` | Hugging Face model id. Required for the `diffusers` backend. |
|
|
190
|
+
| `--steps`, `--guidance` | Sampler steps and guidance scale. FLUX.1-schnell presets to 4 steps and guidance 0. Other models use the pipeline defaults. CLI values win. |
|
|
191
|
+
| `--dtype` | Requested dtype. On CPU, float16 and bfloat16 load as float32. `describe()` stores the dtype actually used in `dtype` and the flag in `requested_dtype`. |
|
|
192
|
+
| `--device` | Device for the pipeline and for metrics. With no flag, metrics use CUDA when torch reports it, otherwise MPS, otherwise CPU. Without torch, metrics use CPU. |
|
|
193
|
+
| `--attention` | `sdpa`, `xformers`, or `eager`. With no flag, the pipeline default stays. |
|
|
194
|
+
| `--variant` | Diffusers pipeline variant. |
|
|
195
|
+
| `--batch-size` | Positive integer. Default 1. |
|
|
196
|
+
| `--seeds` | Comma-separated integers, overriding the suite. Example: `--seeds 0,1,2`. |
|
|
197
|
+
| `--metrics` | Comma-separated metric names, overriding the suite. |
|
|
198
|
+
| `--width`, `--height` | Image size in pixels, overriding the suite. |
|
|
199
|
+
| `--output` | Output directory. |
|
|
200
|
+
| `--strict` | Exit 2 unless every aggregate status is `ok`. The report is still written. |
|
|
201
|
+
|
|
202
|
+
`describe()` also records `steps_source` and `guidance_source` as `cli`, `preset`, or `pipeline-default`.
|
|
203
|
+
|
|
204
|
+
## Metrics
|
|
205
|
+
|
|
206
|
+
| Metric | Better | Implementation | Needs references |
|
|
207
|
+
| --- | :---: | --- | :---: |
|
|
208
|
+
| `clip_score` | higher | Hessel et al. 2021, CLIP ViT-B/32. Mean of `2.5 * max(cosine, 0)` on the raw prompt, truncated to 77 tokens. | no |
|
|
209
|
+
| `cmmd` | lower | Jayasumana et al. 2024, CLIP ViT-L/14 at 336, center square crop, L2-normalized vision embeddings. Minimum-variance RBF MMD, diagonal included, sigma 10, scaled by 1000. Matches the [cmmd-pytorch](https://github.com/sayakpaul/cmmd-pytorch) sample check of 7.696. | yes |
|
|
210
|
+
| `fid` | lower | clean-fid `compute_fid`, `mode="clean"`, Inception-v3. clean-fid resizes each RGB image to 299×299. diffeval does not resize the PNG first. | yes |
|
|
211
|
+
| `kid` | lower | clean-fid `compute_kid` on the same features. Degree-3 polynomial, 100 subsets, subset size at most 1000. | yes |
|
|
212
|
+
| `geneval` | higher | Stub. Returns `skipped`. `details.by_tag` maps `single_object`, `two_object`, `counting`, `colors`, `position`, and `color_attr` to null. Mask2Former is not imported. | no |
|
|
213
|
+
|
|
214
|
+
The registered metrics are `clip_score`, `cmmd`, `fid`, `kid`, and `geneval`.
|
|
215
|
+
|
|
216
|
+
`clip_score`, `cmmd`, `fid`, and `kid` return `skipped` when their library is missing. `fid`, `kid`, and `cmmd` also skip when the suite has no reference. A reference is an image folder, precomputed `clean_fid_stats` for `fid` and `kid`, or a `.npy` CLIP embedding for `cmmd`. `fid` and `kid` also skip when the generated folder or the reference folder has fewer than two images. Both calls seed NumPy with the evaluation seed and restore the previous state. FID, KID, and CMMD set `details.warning` when the image count is below the published COCO setup of 30000. The `metrics` extra pins SciPy below 1.18: clean-fid 0.1.35 calls `scipy.linalg.sqrtm` with `disp=False`, which SciPy 1.18 removed, so `fid` and `kid` would error.
|
|
217
|
+
|
|
218
|
+
`diffeval-check-cmmd` downloads the six cmmd-pytorch sample images and checks that `cmmd` returns 7.696, the value that implementation documents. Earlier versions skipped the L2 normalization and the center crop, so their `cmmd` values are not comparable with published ones.
|
|
219
|
+
|
|
220
|
+
[Benchmarks](https://github.com/woletee/diffeval/blob/main/docs/BENCHMARKS.md) compares diffeval with published CMMD values and lists the commands to reproduce them.
|
|
221
|
+
|
|
222
|
+
Each metric's `protocol` dict is copied into `metric_protocols` in `results.json`.
|
|
223
|
+
|
|
224
|
+
### How scores are aggregated
|
|
225
|
+
|
|
226
|
+
| Status | Meaning |
|
|
227
|
+
| --- | --- |
|
|
228
|
+
| `ok` | every seed succeeded |
|
|
229
|
+
| `partial` | some seeds succeeded |
|
|
230
|
+
| `skipped` | every seed was skipped |
|
|
231
|
+
| `error` | at least one seed failed and none succeeded |
|
|
232
|
+
|
|
233
|
+
The mean uses successful seeds only. The standard deviation is null below two successful seeds, which the console prints as `n/a`.
|
|
234
|
+
|
|
235
|
+
## Backends
|
|
236
|
+
|
|
237
|
+
| Backend | Description |
|
|
238
|
+
| --- | --- |
|
|
239
|
+
| `dummy` | Deterministic RGB images. CI and the smoke command use it. `describe()` sets `device` to `cpu` and `attention_backend` to `none`. |
|
|
240
|
+
| `diffusers` | `AutoPipelineForText2Image`. Each request gets its own CPU `torch.Generator`, seeded from that request. |
|
|
241
|
+
|
|
242
|
+
fal and Replicate are not registered. v1 ships `dummy` and `diffusers` only.
|
|
243
|
+
|
|
244
|
+
## Suites
|
|
245
|
+
|
|
246
|
+
A suite is a YAML file. A file that omits width or height gets 512 for each. A file that omits metrics gets `clip_score`, `cmmd`, `fid`, and `kid`. Prompt ids match `[A-Za-z0-9_-]+`, because they become file names.
|
|
247
|
+
|
|
248
|
+
```yaml
|
|
249
|
+
name: shapes
|
|
250
|
+
description: Two prompts for a local check.
|
|
251
|
+
seeds: [0, 1]
|
|
252
|
+
width: 512
|
|
253
|
+
height: 512
|
|
254
|
+
metrics: [clip_score]
|
|
255
|
+
prompts:
|
|
256
|
+
- {id: red_cube, prompt: a red cube}
|
|
257
|
+
- {id: blue_sphere, prompt: a blue sphere}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
diffeval run --backend dummy --suite path/to/shapes.yaml
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
The bundled `core` suite has four synthetic prompts (`red_cube`, `blue_sphere`, `green_triangle`, `yellow_star`), seeds `[0, 1]`, 512×512 images, and small reference drawings under `reference_dir`. Those drawings are not COCO. A `core` score is a smoke check.
|
|
265
|
+
|
|
266
|
+
## Extending diffeval
|
|
267
|
+
|
|
268
|
+
Importing `diffeval` loads the plugins. Each task, metric, and backend registers into `TASKS`, `METRICS`, or `BACKENDS`. Add a module, import it from the matching package `__init__.py`, and the name shows up in `diffeval list`.
|
|
269
|
+
|
|
270
|
+
<details>
|
|
271
|
+
<summary><b>Add a metric</b></summary>
|
|
272
|
+
|
|
273
|
+
<br>
|
|
274
|
+
|
|
275
|
+
The runner constructs the class with no arguments and calls `compute(samples, context)` once per seed. Return a `MetricResult`. Status `ok` carries a finite float. Status `skipped` or `error` carries a null value and an error string. `protocol` is copied into `metric_protocols`.
|
|
276
|
+
|
|
277
|
+
```python
|
|
278
|
+
from diffeval.metrics.ok import ok
|
|
279
|
+
from diffeval.metrics.skipped import skipped
|
|
280
|
+
from diffeval.registry.register import register
|
|
281
|
+
from diffeval.registry.tables import METRICS
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
@register(METRICS, "example")
|
|
285
|
+
class Example:
|
|
286
|
+
name = "example"
|
|
287
|
+
description = "What the number means."
|
|
288
|
+
higher_is_better = True
|
|
289
|
+
requires_references = False
|
|
290
|
+
protocol = {"formula": "state the formula here"}
|
|
291
|
+
|
|
292
|
+
def compute(self, samples, context):
|
|
293
|
+
try:
|
|
294
|
+
import some_library
|
|
295
|
+
except ImportError:
|
|
296
|
+
return skipped(self.name, "install some_library", self.higher_is_better, self.protocol)
|
|
297
|
+
value = ... # a finite float for this seed
|
|
298
|
+
return ok(self.name, value, self.higher_is_better, self.protocol)
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
A missing optional library returns `skipped`, with the reason in the error string.
|
|
302
|
+
|
|
303
|
+
</details>
|
|
304
|
+
|
|
305
|
+
<details>
|
|
306
|
+
<summary><b>Add a backend</b></summary>
|
|
307
|
+
|
|
308
|
+
<br>
|
|
309
|
+
|
|
310
|
+
The runner calls `from_config(config)` on the class, then `prepare()`, `generate(requests)`, and `describe()`.
|
|
311
|
+
|
|
312
|
+
`generate` returns one `diffeval.types.sample.Sample` per request, in request order. `Sample.image` is a PIL RGB image seeded from that request's seed. The runner writes it to a path like `images/seed_0/red_cube.png`.
|
|
313
|
+
|
|
314
|
+
`describe()` returns `name`, `pipeline`, `dtype`, `requested_dtype`, `steps`, `guidance`, `steps_source`, `guidance_source`, `batch_size`, `device`, `attention_backend`, and `variant`.
|
|
315
|
+
|
|
316
|
+
[`src/diffeval/backends/dummy/backend.py`](src/diffeval/backends/dummy/backend.py) is the short example.
|
|
317
|
+
|
|
318
|
+
</details>
|
|
319
|
+
|
|
320
|
+
<details>
|
|
321
|
+
<summary><b>Register a named suite</b></summary>
|
|
322
|
+
|
|
323
|
+
<br>
|
|
324
|
+
|
|
325
|
+
To make a suite available by name, register an object with `description` and `load()`. The runner calls `load()` on that object. It does not construct the class. Follow [`src/diffeval/tasks/core.py`](src/diffeval/tasks/core.py), which registers an instance.
|
|
326
|
+
|
|
327
|
+
```python
|
|
328
|
+
from diffeval.registry.register import register
|
|
329
|
+
from diffeval.registry.tables import TASKS
|
|
330
|
+
from diffeval.tasks.load_path import load_path
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
class Shapes:
|
|
334
|
+
description = "Two prompts for a local check."
|
|
335
|
+
|
|
336
|
+
def load(self):
|
|
337
|
+
return load_path("path/to/shapes.yaml")
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
register(TASKS, "shapes")(Shapes())
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
To ship a suite with the package, put its YAML in `src/diffeval/tasks/suites/` and import the module from `src/diffeval/tasks/__init__.py`.
|
|
344
|
+
|
|
345
|
+
</details>
|
|
346
|
+
|
|
347
|
+
## Project layout
|
|
348
|
+
|
|
349
|
+
```text
|
|
350
|
+
src/diffeval/
|
|
351
|
+
├── cli/ argument parsing and the list / run commands
|
|
352
|
+
├── tasks/ suite loading and the bundled suites
|
|
353
|
+
├── backends/ dummy and diffusers
|
|
354
|
+
├── metrics/ clip_score, cmmd, fid, kid, geneval
|
|
355
|
+
├── runner/ per-seed generation and scoring
|
|
356
|
+
├── aggregate/ mean, sample std, and status across seeds
|
|
357
|
+
├── report/ console, Markdown, and HTML
|
|
358
|
+
├── registry/ TASKS, METRICS, and BACKENDS
|
|
359
|
+
├── system/ package versions, GPU, and attention flags
|
|
360
|
+
└── types/ shared records
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
Every `.py` file in `src/` and `tests/` has at most 20 lines of code. Blank lines, comments, and docstrings do not count. Imports do. [docs/DESIGN.md](https://github.com/woletee/diffeval/blob/main/docs/DESIGN.md) is the rule and the module tree. [docs/ROADMAP.md](https://github.com/woletee/diffeval/blob/main/docs/ROADMAP.md) is the split into pull requests.
|
|
364
|
+
|
|
365
|
+
## Contributing
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
pip install -e ".[dev]"
|
|
369
|
+
pytest
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
CI runs that on Python 3.10, 3.11, and 3.12, then runs `diffeval run --backend dummy --suite core`.
|
|
373
|
+
|
|
374
|
+
Keep new behavior inside the line cap. Register tasks, metrics, and backends by name. Do not commit model weights. Do not report a smoke score as a paper result.
|
|
375
|
+
|
|
376
|
+
## License
|
|
377
|
+
|
|
378
|
+
Apache-2.0. See [LICENSE](https://github.com/woletee/diffeval/blob/main/LICENSE).
|