Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Molly/enable unet1d #2242

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions torchbenchmark/models/unet1d/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from ...util.model import BenchmarkModel

import torch
from diffusers import UNet1DModel

class Model(BenchmarkModel):
DEFAULT_EVAL_BSIZE = 32
def __init__(self, test, device, batch_size=None, extra_args=[]):
super().__init__( test=test, device=device,
batch_size=batch_size, extra_args=extra_args)

self.in_channels = 32
self.seq_len = 256
self.num_features = 16
self.block_out_channels = (self.seq_len, 64, 64)
print(self.batch_size)
self.example_inputs = torch.randn(1, self.num_features, self.seq_len)
self.timesteps = torch.tensor([1])
self.model = UNet1DModel(in_channels=self.in_channels, block_out_channels=self.block_out_channels)

def get_module(self):
return self.model, self.example_inputs

def eval(self):
self.model.eval()
with torch.no_grad():
out=self.model(self.example_inputs, self.timesteps)
9 changes: 9 additions & 0 deletions torchbenchmark/models/unet1d/install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import subprocess
import sys
import os

def pip_install_requirements():
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-q', '-r', 'requirements.txt'])

if __name__ == '__main__':
pip_install_requirements()
8 changes: 8 additions & 0 deletions torchbenchmark/models/unet1d/metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
devices:
NVIDIA A100-SXM4-40GB:
eval_batch_size: 64
eval_benchmark: true
eval_deterministic: false
eval_nograd: true
train_benchmark: false
train_deterministic: false
1 change: 1 addition & 0 deletions torchbenchmark/models/unet1d/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
diffusers
Loading