LaMDA-rlhf-pytorch
LaMDA-rlhf-pytorch copied to clipboard
Add poetry packaging
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
- Clone the repo
- Install poetry. See official guide
- Navigate to the directory
- Install the dependencies
poetry install - Activate the virtual environment
poetry shell - 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.
- Build your library
poetry build - Publish it
poetry publish
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