Skip to main content

A library, based on PyTorch, that implements bertserini code.

Project description

Bertserini-on-Telegram

schema.jpeg

Bertserini-on-Telegram is a pytorch Bertserini implementation with a small utility to plug it in a Telegram bot. The models and dataloaders are written in PyTorchLightning, and are usable on their own, or via PyTorchLightning CLI.

Project Structure

A typical top-level directory layout

.
├── bertserini_on_telegram      # Actual project code
|    ├── data                   # contains the DataModules to handle SQuAD V1.1
|    ├── models                 # holds the Modules to run validation and inference with BERT
|    └── utils                  # general helper functions
├── examples                    # Example scripts of how to run the code
├── LICENSE
└── README.md

Installation

Install via pip

pip install bertserini-on-telegram

Usage

The fastest way to learn how to use this package is by heading on tothe examples folder, and have a look at the python scripts saved in there. In each example folder, there is a config.yaml file holding the run parameters, a script.py file where the actual example code is, and a runnable script.sh file that shows how to run a PytorchLightningCli script with a config file.

To run an example, simply

cd examples/<example_dir>
./example_shell_script.sh

Running it on Telegram

The telegram example supposes that the used knows how to create a Telegram bot in the first place. Telegram has an awesome tutorial on how to do it, you can find it here.

Once the bot is online, the next step is to insert the bot's private token into the config.yaml file, as shown below (the file needs to be created)

./example/telegram_bot/telegram_token_id.yaml

token_id: <token_id>

Be careful when adding a bot to a group, it must have the necessary permission to be able to read the messages.

Now just run the example as shown in the snippet below, and you are good to go :)

cd examples/telegram_bot
./run_bertbot.sh

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

bertserini_on_telegram-1.2.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

bertserini_on_telegram-1.2-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file bertserini_on_telegram-1.2.tar.gz.

File metadata

  • Download URL: bertserini_on_telegram-1.2.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.10.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

File hashes

Hashes for bertserini_on_telegram-1.2.tar.gz
Algorithm Hash digest
SHA256 53c54c689464771c41d9a7a131ea4397fbc54decba5e4b74c20c6070d22515b3
MD5 60e2c8bc290e4002846a262132e6d134
BLAKE2b-256 f1623c8324013706a35595f8d9c38b8bbe38e5c4a3f1d6bbe1a1ac0285b61a5c

See more details on using hashes here.

File details

Details for the file bertserini_on_telegram-1.2-py3-none-any.whl.

File metadata

  • Download URL: bertserini_on_telegram-1.2-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.10.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

File hashes

Hashes for bertserini_on_telegram-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 308b4adb403d6a01028ea0fd9d508b2754db7b9b2f3dcdff8d5dbb96850bd96d
MD5 708de658bbd284afddab9c7c533c5637
BLAKE2b-256 5e78f3718df4ae0dc9d5d310186a8e6d7c364d1b6754303f80fbeef25760f61c

See more details on using hashes here.

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