Skip to content

Commit 28ec933

Browse files
fix: replace prod not supported py3.7
1 parent 36fc9be commit 28ec933

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

audio_diffusion_pytorch/model.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import random
2-
from math import prod
32
from typing import Optional, Sequence, Union
43

54
import torch
@@ -16,7 +15,7 @@
1615
Schedule,
1716
)
1817
from .modules import Encoder1d, ResnetBlock1d, UNet1d
19-
from .utils import default, to_list
18+
from .utils import default, prod, to_list
2019

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

audio_diffusion_pytorch/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from functools import reduce
12
from inspect import isfunction
23
from typing import Callable, List, Optional, Sequence, TypeVar, Union
34

@@ -30,3 +31,7 @@ def to_list(val: Union[T, Sequence[T]]) -> List[T]:
3031
if isinstance(val, list):
3132
return val
3233
return [val] # type: ignore
34+
35+
36+
def prod(vals: Sequence[int]) -> int:
37+
return reduce(lambda x, y: x * y, vals)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setup(
44
name="audio-diffusion-pytorch",
55
packages=find_packages(exclude=[]),
6-
version="0.0.25",
6+
version="0.0.26",
77
license="MIT",
88
description="Audio Diffusion - PyTorch",
99
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)