From c23c5ae6d9551e2c6338364a06498cbf8691d578 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 13 Mar 2024 11:48:10 -0700 Subject: [PATCH 1/6] Update nightly-build.yml --- .github/workflows/nightly-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index d26a3fa395..cfdaf62ace 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -32,5 +32,5 @@ jobs: 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/ From 26262d19996bc242580e3ac9a88e421d2fd17338 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 13 Mar 2024 11:52:34 -0700 Subject: [PATCH 2/6] Update setup.py --- setup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.py b/setup.py index fad6c316d2..8a5d607659 100644 --- a/setup.py +++ b/setup.py @@ -10,9 +10,7 @@ name='torchao', version='0.0.3', 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', From 4a7cdaa46262d1ba44f7245f88b609645daa28dc Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 13 Mar 2024 11:52:43 -0700 Subject: [PATCH 3/6] Update requirements.txt --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f7a4d821ed..e62b709c4c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ +torch numpy -sentencepiece \ No newline at end of file +sentencepiece From 7a5c36b139179fbf579ee18f8a64389436cd097d Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 13 Mar 2024 11:56:24 -0700 Subject: [PATCH 4/6] Update setup.py --- setup.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 8a5d607659..acecbb6bde 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,21 @@ # 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 setuptools import setup, find_packages +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' + setup( - name='torchao', - version='0.0.3', + name=package_name, + version='0.0.3' if package_name == 'torchao' else '0.0.3.dev20240313', packages=find_packages(), install_requires=read_requirements('requirements.txt'), description='Package for applying ao techniques to GPU models', From 60dfc9f6ede2a8ee67db52a929962989e507a038 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 13 Mar 2024 11:57:01 -0700 Subject: [PATCH 5/6] Update nightly-build.yml --- .github/workflows/nightly-build.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index cfdaf62ace..45b89bb1db 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -18,14 +18,9 @@ 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 From ca92e0e405b8f85fcbe0a058f2be907658108cf3 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 13 Mar 2024 12:02:14 -0700 Subject: [PATCH 6/6] Update setup.py --- setup.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index acecbb6bde..b478c807ca 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,10 @@ # 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: @@ -13,9 +16,13 @@ def read_requirements(file_path): # 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=package_name, - version='0.0.3' if package_name == 'torchao' else '0.0.3.dev20240313', + version=version, packages=find_packages(), install_requires=read_requirements('requirements.txt'), description='Package for applying ao techniques to GPU models',