Skip to content

Commit

Permalink
handle installation of packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
freewym committed Oct 7, 2022
1 parent 11eb671 commit 9944ec7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion espresso/modules/speech_convolutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@

import torch
import torch.nn.functional as F
from packaging import version

try:
from packaging import version

has_packaging = True
except ImportError:
has_packaging = False
from torch import nn

import espresso.tools.utils as speech_utils
Expand All @@ -18,6 +24,8 @@ class ConvBNReLU(nn.Module):

def __init__(self, out_channels, kernel_sizes, strides, in_channels=1):
super().__init__()
if not has_packaging:
raise ImportError("Please install packaging with: pip install packaging")
self.out_channels = out_channels
self.kernel_sizes = kernel_sizes
self.strides = strides
Expand Down

0 comments on commit 9944ec7

Please sign in to comment.