MCPcopy Create free account
hub / github.com/ace-step/ACE-Step / wrapper

Function wrapper

acestep/cpu_offload.py:30–40  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

28 def decorator(func: Callable[..., T]) -> Callable[..., T]:
29 @functools.wraps(func)
30 def wrapper(self, *args, **kwargs):
31 if not self.cpu_offload:
32 return func(self, *args, **kwargs)
33
34 # Get the device from the class
35 device = self.device
36 # Get the model from the class attribute
37 model = getattr(self, model_attr)
38
39 with CpuOffloader(model, device):
40 return func(self, *args, **kwargs)
41
42 return wrapper
43 return decorator

Callers

nothing calls this directly

Calls 1

CpuOffloaderClass · 0.85

Tested by

no test coverage detected