conceptofmind / LaMDA-rlhf-pytorch

Open-source pre-training implementation of Google's LaMDA in PyTorch. Adding RLHF similar to ChatGPT.
MIT License
466 stars 76 forks source link

Add poetry packaging #1

Open Aleksandar1932 opened 2 years ago

Aleksandar1932 commented 2 years ago

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](https://python-poetry.org/docs/libraries/#:~:text=Poetry%20will%20publish%20to%20PyPI,publish%20on%20PyPI%20as%20well.).

1. Build your library `poetry build`
2. Publish it `poetry publish`
conceptofmind commented 2 years ago

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