rreece / poetry-torch

An example of using poetry to setup a python virtualenv that has pytorch installed

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

poetry-torch

CI badge

An example of using poetry to setup a python virtualenv that has pytorch installed.

This package also shows examples of loading and using HuggingFace models. So far, all the models used are for NLP.

An analogous project using plain virtualenv instead of poetry is venv-torch.

How to setup

First time running, install by

poetry install

Then start the environment by

poetry shell

Run sentiment scoring of your input texts

This test can be run interactively:

cd tests
python test_hf_bert_sentiment.py

Run the tests

Run all the tests:

pytest

How this was created

poetry new poetry-torch
cd poetry-torch
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry config virtualenvs.path ".venv"
poetry add numpy
poetry add pytest
poetry add sentencepiece
poetry add torch --platform linux --python "^3.8"
poetry add transformers
poetry install
poetry lock

Author

Ryan Reece (@rreece)
Created: November 2, 2022

About

An example of using poetry to setup a python virtualenv that has pytorch installed

License:MIT License


Languages

Language:Python 92.4%Language:Makefile 7.6%