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

Updating BasedSettings and other compatibility issues #124

Open
wants to merge 2 commits into
base: master
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
2 changes: 1 addition & 1 deletion howl/client/howl_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _on_audio(self, in_data, frame_count, time_info, status_flags):
return data_ok

def _normalize_audio(self, audio_data):
return np.frombuffer(audio_data, dtype=np.int16).astype(np.float) / self._audio_float_size
return np.frombuffer(audio_data, dtype=np.int16).astype(float) / self._audio_float_size

def start(self):
"""Start the audio stream for inference"""
Expand Down
2 changes: 1 addition & 1 deletion howl/model/cnn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Tuple

from pydantic import BaseSettings
from pydantic_settings import BaseSettings
from torchvision.models import MobileNetV2, mobilenet_v2
import torch
import torch.nn as nn
Expand Down
2 changes: 1 addition & 1 deletion howl/model/rnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import torch
import torch.nn as nn
import torch.nn.functional as F
from pydantic import BaseSettings
from pydantic_settings import BaseSettings
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence

from .base import RegisteredModel
Expand Down
10 changes: 5 additions & 5 deletions howl/settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import multiprocessing
from typing import List
from typing import List, Optional

from pydantic import BaseSettings
from pydantic_settings import BaseSettings

__all__ = ["AudioSettings", "DatasetSettings", "SETTINGS"]

Expand Down Expand Up @@ -38,7 +38,7 @@ class AudioTransformSettings(BaseSettings):
class InferenceEngineSettings(BaseSettings):
"""Base settings for inference engine"""

inference_weights: List[float] = None
inference_weights: Optional[List[float]] = None
inference_sequence: List[int] = [0]
inference_window_ms: float = 2000 # look at last of these seconds
smoothing_window_ms: float = 50 # prediction smoothed
Expand Down Expand Up @@ -66,9 +66,9 @@ class TrainingSettings(BaseSettings):
objective: str = "frame" # frame or ctc
# TODO: support phone token_type
token_type: str = "word"
phone_dictionary: str = None
phone_dictionary: Optional[str] = None
use_noise_dataset: bool = False
noise_dataset_path: str = None
noise_dataset_path: Optional[str] = None


class DatasetSettings(BaseSettings):
Expand Down
2 changes: 1 addition & 1 deletion howl/utils/dataclass.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json

from pydantic import BaseSettings
from pydantic_settings import BaseSettings
from pathlib import PosixPath


Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ praat-textgrids==1.3.1
protobuf==3.19.4 # Protobuf 4.21.0 contains a breaking change for Python, as explained here: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
pyaudio
pydantic>=1.7.3
pydantic_settings
pytest==6.2.3
pytest-timeout==2.1.0
soundfile==0.10.3.post1
tensorboard==2.8.0
torch==1.10.1
torch>=1.10.1
torchaudio>=0.5.0
torchvision>=0.6.0
tqdm