Skip to content

Commit

Permalink
Adhoc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinborner committed Sep 5, 2023
1 parent 46b23fd commit a835e8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions swr2_asr/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import click
import torch
import torch.nn
import torch.nn.functional as F
from torch import nn, optim
from torch.utils.data import DataLoader
Expand Down Expand Up @@ -166,12 +167,12 @@ def run(
# load tokenizer (bpe by default):
if not os.path.isfile("data/tokenizers/char_tokenizer_german.json"):
print("There is no tokenizer available. Do you want to train it on the dataset?")
input("Press Enter to continue...")
#input("Press Enter to continue...")
train_char_tokenizer(
dataset_path=dataset_path,
language=language,
split="all",
download=False,
#download=False,
out_path="data/tokenizers/char_tokenizer_german.json",
)

Expand Down Expand Up @@ -221,7 +222,8 @@ def run(
hparams["n_feats"],
hparams["stride"],
hparams["dropout"],
).to(device)
)
model = nn.DataParallel(model).to(device)
print(tokenizer.encode(" "))
print("Num Model Parameters", sum((param.nelement() for param in model.parameters())))
optimizer = optim.AdamW(model.parameters(), hparams["learning_rate"])
Expand Down
4 changes: 2 additions & 2 deletions swr2_asr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __init__(
language: str,
split: Split,
download: bool,
spectrogram_hparams: dict | None,
spectrogram_hparams,
):
"""Initializes the dataset"""
self.dataset_path = dataset_path
Expand Down Expand Up @@ -162,7 +162,7 @@ def initialize(self) -> None:
"chapterid": path[2],
"utterance": utterance,
}
for path, utterance in zip(identifier, utterances, strict=False)
for path, utterance in zip(identifier, utterances)
]

def set_tokenizer(self, tokenizer: type[TokenizerType]):
Expand Down

0 comments on commit a835e8f

Please sign in to comment.