Skip to content

Commit

Permalink
formatting fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Kornuta <tkornuta@nvidia.com>
  • Loading branch information
tkornuta-nvidia committed Mar 24, 2020
1 parent 15b3b11 commit 2756a66
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
# limitations under the License.
# =============================================================================

from os.path import expanduser
from functools import partial
from os.path import expanduser

from ruamel.yaml import YAML

import nemo
from nemo.core import NeuralGraph, OperationMode
import nemo.collections.asr as nemo_asr
from nemo.collections.asr.helpers import monitor_asr_train_progress
from nemo.core import NeuralGraph, OperationMode

logging = nemo.logging

Expand All @@ -41,9 +41,9 @@
)

# Set paths to "manifests" and model configuration files.
train_manifest="~/TestData/an4_dataset/an4_train.json"
val_manifest="~/TestData/an4_dataset/an4_val.json"
model_config_file="~/workspace/nemo/examples/asr/configs/jasper_an4.yaml"
train_manifest = "~/TestData/an4_dataset/an4_train.json"
val_manifest = "~/TestData/an4_dataset/an4_val.json"
model_config_file = "~/workspace/nemo/examples/asr/configs/jasper_an4.yaml"

yaml = YAML(typ="safe")
with open(expanduser(model_config_file)) as f:
Expand Down Expand Up @@ -71,14 +71,14 @@

# Create the Jasper composite module.
with NeuralGraph(operation_mode=OperationMode.training) as Jasper:
processed_signal, processed_signal_len = data_preprocessor(input_signal=Jasper, length=Jasper) # Bind inputs.
processed_signal, processed_signal_len = data_preprocessor(input_signal=Jasper, length=Jasper) # Bind inputs.
encoded, encoded_len = jasper_encoder(audio_signal=processed_signal, length=processed_signal_len)
log_probs = jasper_decoder(encoder_output=encoded) # All output ports are bind (for now!)
log_probs = jasper_decoder(encoder_output=encoded) # All output ports are bind (for now!)

# Create the "implicit" training graph.
audio_signal, audio_signal_len, transcript, transcript_len = data_layer()
# Use Jasper module as any other neural module.
_, _, _, encoded_len, log_probs = Jasper(input_signal=audio_signal, length=audio_signal_len)
_, _, _, encoded_len, log_probs = Jasper(input_signal=audio_signal, length=audio_signal_len)
predictions = greedy_decoder(log_probs=log_probs)
loss = ctc_loss(log_probs=log_probs, targets=transcript, input_length=encoded_len, target_length=transcript_len)
tensors_to_evaluate = [loss, predictions, transcript, transcript_len]
Expand Down
6 changes: 4 additions & 2 deletions examples/start_here/graph_composition_integration_tests1_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
m2 = nemo.tutorials.TaylorNet(dim=4)
loss = nemo.tutorials.MSELoss()

logging.info("This example shows how one can build an `explicit` graph."
F"It also shows how to decouple graph instance creation from its activation.")
logging.info(
"This example shows how one can build an `explicit` graph."
F"It also shows how to decouple graph instance creation from its activation."
)

# Create the g0 graph.
g0 = NeuralGraph(operation_mode=OperationMode.training)
Expand Down
8 changes: 5 additions & 3 deletions examples/start_here/graph_composition_integration_tests1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# =============================================================================

import nemo
from nemo.core import NeuralGraph, OperationMode, AppState
from nemo.core import AppState, NeuralGraph, OperationMode

logging = nemo.logging

Expand All @@ -28,8 +28,10 @@
m2 = nemo.tutorials.TaylorNet(dim=4)
loss = nemo.tutorials.MSELoss()

logging.info("This example shows how one can build an `explicit` graph."
F"It also shows how to activate and deactivate the g0 context `manually`")
logging.info(
"This example shows how one can build an `explicit` graph."
F"It also shows how to activate and deactivate the g0 context `manually`"
)

# Create the g0 graph.
g0 = NeuralGraph(operation_mode=OperationMode.training)
Expand Down

0 comments on commit 2756a66

Please sign in to comment.