How to do it...

  1. We start by loading the necessary libraries:
import osimport reimport sysimport jsonimport mathimport timeimport stringimport requestsimport ioimport numpy as npimport collectionsimport randomimport pickleimport stringimport matplotlib.pyplot as pltimport tensorflow as tffrom zipfile import ZipFilefrom collections import Counterfrom tensorflow.python.ops import lookup_opsfrom tensorflow.python.framework import opsops.reset_default_graph()local_repository = 'temp/seq2seq'
  1. The following block of code will import the whole NMT model repository into the temp folder:
if not os.path.exists(local_repository): from git import Repo tf_model_repository = 'https://github.com/tensorflow/nmt/' Repo.clone_from(tf_model_repository, local_repository) ...

Get TensorFlow Machine Learning Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.