| 108 | |
| 109 | |
| 110 | class PatchTypeSamplerPostCfgFunction(PatchTypeModel): |
| 111 | def get_patches(self, model_options): |
| 112 | return model_options.get(self.name, ()) |
| 113 | |
| 114 | def set_patches(self, model_options, val): |
| 115 | model_options[self.name] = val |
| 116 | |
| 117 | _call_result_key = "denoised" |
| 118 | |
| 119 | @classmethod |
| 120 | def _call(cls, patches, opts): |
| 121 | if not patches: |
| 122 | return opts["denoised"] |
| 123 | curr_opts = opts.copy() |
| 124 | key = cls._call_result_key |
| 125 | for p in patches: |
| 126 | result = p(curr_opts) |
| 127 | curr_opts[key] = result |
| 128 | return result |
| 129 | |
| 130 | |
| 131 | class PatchTypeSamplerPreCfgFunction(PatchTypeSamplerPostCfgFunction): |
no outgoing calls
no test coverage detected