Skip to content

CLI to deploy & query Hugging Face model to Amazon SageMaker

License

Notifications You must be signed in to change notification settings

abzdel/Summarize-CLI

Repository files navigation

Tests Makefile

Summarize CLI

Summarize CLI is a project that leverages the Pegasus-Xsum model from Hugging Face to generate summaries of input text. The tool is implemented in Python and Bash and is deployed to AWS SageMaker for remote inference. The project includes a command-line interface as well as a Jupyter notebook version of the same logic for interactive use.

To use Summarize CLI, the user will need Python 3, AWS CLI, an AWS account, and optionally Jupyter notebook. The installation process is straightforward, requiring only the cloning of the repository and the installation of the required Python packages.

Once installed, Summarize CLI can be used from the command line to generate summaries of input text using the Pegasus-Xsum model. This tool provides a useful tool for generating summaries of input text, making it a valuable resource for anyone who needs to summarize large volumes of text quickly and accurately.

Architectural Diagram

ids721 project 1 drawio

Prerequisites

To use Summarize CLI, you will need the following:

  • Python 3
  • AWS CLI
  • An AWS account
  • Jupyter notebook (optional)

How to run

  1. Clone repository
git clone https://github.com/nogibjj/Summarize-CLI.git
  1. Install dependencies
make install
  1. Deploy model (takes a while)
./summarize deploy (or ./summarize d)
  1. Put desired input in corpus.txt in root directory. Must be less than 1024 words as per the model's restrictions

  2. Query endpoint

./summarize query (or ./summarize q)
  1. View results in output_file.txt

  2. IMPORTANT: Always turn off your resources after using the tool!

./summarize remove (or ./summarize rem)

Jupyter notebook

To use the Jupyter notebook version of Summarize CLI, open the summarize.ipynb notebook in Jupyter and follow the instructions in the notebook.