Skip to content

Commit cbb64d6

Browse files
authored
Fix Nightly build script (#54)
* Update nightly-build.yml * Update setup.py * Update requirements.txt * Update setup.py * Update nightly-build.yml * Update setup.py
1 parent 5fd2b5a commit cbb64d6

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

.github/workflows/nightly-build.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,14 @@ jobs:
1818
run: |
1919
python -m pip install --upgrade pip
2020
pip install setuptools wheel twine
21-
- name: Get current date
22-
id: date
23-
run: echo "::set-output name=date::$(date +'%Y%m%d')"
2421
- name: Build package
2522
run: |
26-
version=$(python setup.py --version)
27-
new_version="${version}.dev${{ steps.date.outputs.date }}"
28-
sed -i "s/version=.*/version='${new_version}',/" setup.py
23+
export TORCHAO_NIGHTLY=1
2924
python setup.py sdist bdist_wheel
3025
- name: Publish package to PyPI
3126
uses: pypa/gh-action-pypi-publish@release/v1
3227
with:
3328
user: __token__
3429
password: ${{ secrets.PYPI_API_TOKEN }}
35-
repository_url: https://pypi.org/project/torchao-nightly/
30+
repository_url: https://upload.pypi.org/legacy/
3631
packages_dir: dist/

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
torch
12
numpy
2-
sentencepiece
3+
sentencepiece

setup.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
# Copyright (c) Meta Platforms, Inc. and affiliates.
22
# All rights reserved.
3-
43
# This source code is licensed under the license found in the
54
# LICENSE file in the root directory of this source tree.
65

6+
import os
7+
from datetime import datetime
78
from setuptools import setup, find_packages
9+
current_date = datetime.now().strftime('%Y.%m.%d')
10+
11+
12+
def read_requirements(file_path):
13+
with open(file_path, 'r') as file:
14+
return file.read().splitlines()
15+
16+
# Determine the package name based on the presence of an environment variable
17+
package_name = 'torchao-nightly' if os.environ.get('TORCHAO_NIGHTLY') else 'torchao'
18+
19+
# Version is year.month.date if using nightlies
20+
version = current_date if package_name == 'torchao-nightly' else '0.0.3'
21+
822

923
setup(
10-
name='torchao',
11-
version='0.0.3',
24+
name=package_name,
25+
version=version,
1226
packages=find_packages(),
13-
install_requires=[
14-
'torch',
15-
],
27+
install_requires=read_requirements('requirements.txt'),
1628
description='Package for applying ao techniques to GPU models',
1729
long_description=open('README.md').read(),
1830
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)