MCPcopy
hub / github.com/Stability-AI/generative-models / autocast

Function autocast

sgm/util.py:52–61  ·  view source on GitHub ↗
(f, enabled=True)

Source from the content-addressed store, hash-verified

50
51
52def autocast(f, enabled=True):
53 def do_autocast(*args, **kwargs):
54 with torch.cuda.amp.autocast(
55 enabled=enabled,
56 dtype=torch.get_autocast_gpu_dtype(),
57 cache_enabled=torch.is_autocast_cache_enabled(),
58 ):
59 return f(*args, **kwargs)
60
61 return do_autocast
62
63
64def load_partial_from_config(config):

Callers 2

do_sampleFunction · 0.85
do_img2imgFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected