LaMDA-rlhf-pytorch icon indicating copy to clipboard operation
LaMDA-rlhf-pytorch copied to clipboard

Add poetry packaging

Open Aleksandar1932 opened this issue 3 years ago • 1 comments

Description

This PR is focused on the TODO note: Add pip installer with PyPI. With the enablement of packaging with poetry. The dependencies are added in pyproject.toml along with the project description, the author's email has to be added afterward.

Testing Steps

  1. Clone the repo
  2. Install poetry. See official guide
  3. Navigate to the directory
  4. Install the dependencies poetry install
  5. Activate the virtual environment poetry shell
  6. Try:
from lamda_pytorch.lamda_pytorch import LaMDA
from lamda_pytorch.utils.utils import AutoregressiveWrapper
import torch

if __name__ == "__main__":
    lamda_base = LaMDA(
        num_tokens = 20000,
        dim = 512,
        dim_head = 64,
        depth = 12,
        heads = 8
    )

    lamda = AutoregressiveWrapper(lamda_base, max_seq_len = 512)

    tokens = torch.randint(0, 20000, (1, 512)) # mock token data

    logits = lamda(tokens)

    print(logits)

Publishing

Poetry supports publishing to PyPi the packaged library, for that follow the official guide.

  1. Build your library poetry build
  2. Publish it poetry publish

Aleksandar1932 avatar Jul 05 '22 20:07 Aleksandar1932

Hi @Aleksandar1932 ,

I was just looking into Poetry for package management the other day, so this pull request comes at the perfect time. I have previously used Twine and setup tools.

I will further review the Poetry documentation over the week and then merge your Pull Request.

Thank you,

Enrico

conceptofmind avatar Jul 05 '22 20:07 conceptofmind