Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Nightly build script #54

Merged
merged 6 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading