Skip to content

Commit

Permalink
Fix Nightly build script (#54)
Browse files Browse the repository at this point in the history
* Update nightly-build.yml

* Update setup.py

* Update requirements.txt

* Update setup.py

* Update nightly-build.yml

* Update setup.py
  • Loading branch information
msaroufim authored Mar 13, 2024
1 parent 5fd2b5a commit cbb64d6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,14 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d')"
- name: Build package
run: |
version=$(python setup.py --version)
new_version="${version}.dev${{ steps.date.outputs.date }}"
sed -i "s/version=.*/version='${new_version}',/" setup.py
export TORCHAO_NIGHTLY=1
python setup.py sdist bdist_wheel
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
repository_url: https://pypi.org/project/torchao-nightly/
repository_url: https://upload.pypi.org/legacy/
packages_dir: dist/
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
torch
numpy
sentencepiece
sentencepiece
24 changes: 18 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.

# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.

import os
from datetime import datetime
from setuptools import setup, find_packages
current_date = datetime.now().strftime('%Y.%m.%d')


def read_requirements(file_path):
with open(file_path, 'r') as file:
return file.read().splitlines()

# Determine the package name based on the presence of an environment variable
package_name = 'torchao-nightly' if os.environ.get('TORCHAO_NIGHTLY') else 'torchao'

# Version is year.month.date if using nightlies
version = current_date if package_name == 'torchao-nightly' else '0.0.3'


setup(
name='torchao',
version='0.0.3',
name=package_name,
version=version,
packages=find_packages(),
install_requires=[
'torch',
],
install_requires=read_requirements('requirements.txt'),
description='Package for applying ao techniques to GPU models',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
Expand Down

0 comments on commit cbb64d6

Please sign in to comment.