Skip to content

Commit

Permalink
Fixed missing import and using x11
Browse files Browse the repository at this point in the history
+ Added `time` import in `train_tacotron.py`
* Modified `utils/display.py` to only use x11 when necessary.
  This will allow training the model on servers where x11 is either
  not installed or not working (e.g. due to improperly forwarded X11)
  • Loading branch information
TheButlah committed Jul 26, 2019
1 parent 1a947d0 commit 1ed4591
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions train_tacotron.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from utils import data_parallel_workaround
import os
from pathlib import Path
import time


def np_now(x: torch.Tensor): return x.detach().cpu().numpy()
Expand Down
6 changes: 6 additions & 0 deletions utils/display.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import matplotlib as mpl
mpl.use('agg') # Use non-interactive backend by default
import matplotlib.pyplot as plt
import time
import numpy as np
Expand Down Expand Up @@ -96,6 +98,7 @@ def save_spectrogram(M, path, length=None):


def plot(array):
mpl.interactive(True)
fig = plt.figure(figsize=(30, 5))
ax = fig.add_subplot(111)
ax.xaxis.label.set_color('grey')
Expand All @@ -105,11 +108,14 @@ def plot(array):
ax.tick_params(axis='x', colors='grey', labelsize=23)
ax.tick_params(axis='y', colors='grey', labelsize=23)
plt.plot(array)
mpl.interactive(False)


def plot_spec(M):
mpl.interactive(True)
M = np.flip(M, axis=0)
plt.figure(figsize=(18,4))
plt.imshow(M, interpolation='nearest', aspect='auto')
plt.show()
mpl.interactive(False)

0 comments on commit 1ed4591

Please sign in to comment.