Skip to content

Commit

Permalink
fix(api): mark all convert methods as no_grad
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Mar 1, 2023
1 parent b44e644 commit 21fc7c5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/onnx_web/convert/diffusion/original.py
Expand Up @@ -1650,6 +1650,7 @@ def extract_checkpoint(
logger.info(result_status)


@torch.no_grad()
def convert_diffusion_original(
ctx: ConversionContext,
model: ModelDict,
Expand Down
1 change: 1 addition & 0 deletions api/onnx_web/convert/diffusion/textual_inversion.py
Expand Up @@ -11,6 +11,7 @@
logger = getLogger(__name__)


@torch.no_grad()
def convert_diffusion_textual_inversion(
context: ConversionContext, name: str, base_model: str, inversion: str
):
Expand Down
8 changes: 8 additions & 0 deletions api/onnx_web/worker/context.py
Expand Up @@ -74,14 +74,22 @@ def clear_flags(self) -> None:


class JobStatus:
name: str
device: str
progress: int
cancelled: bool
finished: bool

def __init__(
self,
name: str,
device: DeviceParams,
progress: int = 0,
cancelled: bool = False,
finished: bool = False,
) -> None:
self.name = name
self.device = device.device
self.progress = progress
self.cancelled = cancelled
self.finished = finished

0 comments on commit 21fc7c5

Please sign in to comment.