Skip to main content

CopyNet with TensorFlow 2.0

Project description

CopyNet implementation with TensorFlow 2

  • Incorporating Copying Mechanism in Sequence-to-Sequence Learning
  • Uses TensorFlow 2.0 and above APIs with tf.keras too
  • Adapted from AllenNLP's PyTorch implementation, their blog referenced below was very helpful to understand the math from an implementation perspective

Python package Upload Python Package

Environment to run examples

Setup

  • Copy sample.env to .env and enter appropriate values for the variables
  • A brief description of each is provided as a comment in that file
  • Post that run,
    ./setup-env.sh [--no-docker]
    
  • Uses env file to configure project environment
  • Builds required docker images (if you don't wanna use Docker then pass --no-docker option to the setup-env.sh script)
  • Makes a python environment and installes required packages in it
  • Prepares an lock.env file. Do not edit/ delete it

Rebuilding environment

  • You may change environment config in the process of development
  • This includes adding a new python package to requirements.txt
  • After changing run,
    ./setup-env.sh [--no-docker]
    
  • If you do not want Docker, then pass --no-docker option similar to before

Start environment

  • At the end of setup script you will be shown the commands to start the environments
  • They are,
    ./start-env.sh nb    # For Dockerized jupyter server
    ./start-env.sh bash  # For Dockerized bash
    
  • It is not necessary to use the start-env.sh script for virtualenv, the regular source command to activate it is enough

Note on Dockerized environment

  • The dockerized environment is specifically helpful and recommended when using GPU
  • It takes care of many nuances involved in setting up CUDA. Your host machine should just have correct NVIDIA drivers and nothing else
  • It is recommended to run the examples in this environment to ensure all correct dependencies are met

Run examples

  • Instructions to run an example are detailed in its own folders respectively

References

  • Incorporating Copying Mechanism in Sequence-to-Sequence Learning: (paper)
  • AllenNLP implementation: (blog) (code)
  • BLEU score metric: (code)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

copynet-tf-0.2.0.tar.gz (21.5 kB view hashes)

Uploaded Source

Built Distribution

copynet_tf-0.2.0-py3-none-any.whl (25.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page