Skip to content

Commit

Permalink
fix: replace prod not supported py3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioschneider committed Sep 8, 2022
1 parent 36fc9be commit 28ec933
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions audio_diffusion_pytorch/model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import random
from math import prod
from typing import Optional, Sequence, Union

import torch
Expand All @@ -16,7 +15,7 @@
Schedule,
)
from .modules import Encoder1d, ResnetBlock1d, UNet1d
from .utils import default, to_list
from .utils import default, prod, to_list

""" Diffusion Classes (generic for 1d data) """

Expand Down
5 changes: 5 additions & 0 deletions audio_diffusion_pytorch/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from functools import reduce
from inspect import isfunction
from typing import Callable, List, Optional, Sequence, TypeVar, Union

Expand Down Expand Up @@ -30,3 +31,7 @@ def to_list(val: Union[T, Sequence[T]]) -> List[T]:
if isinstance(val, list):
return val
return [val] # type: ignore


def prod(vals: Sequence[int]) -> int:
return reduce(lambda x, y: x * y, vals)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name="audio-diffusion-pytorch",
packages=find_packages(exclude=[]),
version="0.0.25",
version="0.0.26",
license="MIT",
description="Audio Diffusion - PyTorch",
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 28ec933

Please sign in to comment.