MCPcopy
hub / github.com/openai/guided-diffusion / create_named_schedule_sampler

Function create_named_schedule_sampler

guided_diffusion/resample.py:8–20  ·  view source on GitHub ↗

Create a ScheduleSampler from a library of pre-defined samplers. :param name: the name of the sampler. :param diffusion: the diffusion object to sample for.

(name, diffusion)

Source from the content-addressed store, hash-verified

6
7
8def create_named_schedule_sampler(name, diffusion):
9 """
10 Create a ScheduleSampler from a library of pre-defined samplers.
11
12 :param name: the name of the sampler.
13 :param diffusion: the diffusion object to sample for.
14 """
15 if name == "uniform":
16 return UniformSampler(diffusion)
17 elif name == "loss-second-moment":
18 return LossSecondMomentResampler(diffusion)
19 else:
20 raise NotImplementedError(f"unknown schedule sampler: {name}")
21
22
23class ScheduleSampler(ABC):

Callers 3

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90

Calls 2

UniformSamplerClass · 0.85

Tested by

no test coverage detected