Skip to content

Commit

Permalink
add truss transfer (#1317)
Browse files Browse the repository at this point in the history
* add truss transfer

* add formatting changes

* running readme

* updated CI and add readme

* update readme, update version

* do not print download url

* update readme

* move the ci

* add ci task for truss-transfer

* add example bptr manifest.json

* add truss-transfer-test.yml

* update ci

* add permissions

* add tmp folder

* improve token of usage

* renamed ci, fix token

* add real bptr resolution

* update wheel creation

* set workdir

* another ci fix with huggingface diff

* add workdir

* add wheel

* add package manager

* fix: sdist

* update package manager

* update ci

* upload sdist case?

* env:
          CROSS_OPENSSL_DIR: /usr

* add truss transfer

* release later

* re-add cI as is

* set up workdir correctly

* back on par with huggingface

* find interpreter

* fix windows symlinking

* cargo fmt

* update libs

* add openssl vendored

* clean up cargo.toml

* bump py03 version

* pyo3 api update

* build free threaded wheels too

* update sdist path

* no windows free-threaded wheels

* update example name

* upload readme
  • Loading branch information
michaelfeil authored Jan 17, 2025
1 parent 8aadbbf commit 1815db1
Show file tree
Hide file tree
Showing 10 changed files with 2,473 additions and 1 deletion.
238 changes: 238 additions & 0 deletions .github/workflows/truss-transfer-build-maturin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
# This file is autogenerated by maturin v1.8.1
# To update, run
#
# maturin generate-ci github
#
name: truss-transfer-build-maturin

on:
push:
branches:
- main
- master
paths:
- 'truss-transfer/**'
tags:
- '*' # Still runs on all tags regardless of directory changes
pull_request:
paths:
- 'truss-transfer/**'
workflow_dispatch:

permissions:
contents: read

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-22.04
target: x86
- runner: ubuntu-22.04
target: aarch64
- runner: ubuntu-22.04
target: armv7
# - runner: ubuntu-22.04
# target: s390x
- runner: ubuntu-22.04
target: ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: truss-transfer
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto
before-script-linux: |
if command -v apt-get &> /dev/null; then
apt-get update && apt-get install libssl-dev libatomic-ops-dev -y
elif command -v yum &> /dev/null; then
yum install openssl-devel devtoolset-10-libatomic-devel perl-IPC-Cmd -y
else
echo "Neither apt-get nor yum is installed. Please install a package manager."
exit 1
fi
- name: Build free-threaded wheels
uses: PyO3/maturin-action@v1
with:
working-directory: truss-transfer
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
sccache: 'true'
manylinux: auto
before-script-linux: |
if command -v apt-get &> /dev/null; then
apt-get update && apt-get install libssl-dev libatomic-ops-dev -y
elif command -v yum &> /dev/null; then
yum install openssl-devel devtoolset-10-libatomic-devel perl-IPC-Cmd -y
else
echo "Neither apt-get nor yum is installed. Please install a package manager."
exit 1
fi
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: truss-transfer/dist

musllinux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-22.04
target: x86
- runner: ubuntu-22.04
target: aarch64
- runner: ubuntu-22.04
target: armv7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: truss-transfer
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: musllinux_1_2
- name: Build free-threaded wheels
uses: PyO3/maturin-action@v1
with:
working-directory: truss-transfer
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
sccache: 'true'
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: truss-transfer/dist

windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: truss-transfer
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
# - name: Build free-threaded wheels
# uses: PyO3/maturin-action@v1
# with:
# target: ${{ matrix.platform.target }}
# args: --release --out dist -i python3.13t
# sccache: 'true'
# working-directory: truss-transfer
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: truss-transfer/dist

macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-13
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: truss-transfer
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Build free-threaded wheels
uses: PyO3/maturin-action@v1
with:
working-directory: truss-transfer
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: truss-transfer/dist

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
working-directory: truss-transfer
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: truss-transfer/dist

release:
name: Release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: [linux, musllinux, windows, macos, sdist]
permissions:
# Use to sign the release artifacts
id-token: write
# Used to upload release artifacts
contents: write
# Used to generate artifact attestation
attestations: write
steps:
- uses: actions/download-artifact@v4
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-path: 'wheels-*/*'
- name: Publish to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*
46 changes: 46 additions & 0 deletions .github/workflows/truss-transfer-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Test truss-transfer

on:
push:
tags:
- '*'
pull_request:
workflow_dispatch:

permissions:
contents: read

defaults:
run:
working-directory: truss-transfer # Keeps default for run commands

jobs:
test-truss-transfer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Create venv
run: python3 -m venv .venv
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: truss-transfer
command: develop
sccache: 'true'
- name: Try import truss-transfer-maturin-publish
run: |
source .venv/bin/activate
python -c "import truss_transfer; print(truss_transfer.__version__)"
- name: Download github file & test real bptr resolution
run: |
sudo mkdir -p /bptr
sudo chown $(whoami):$(whoami) /bptr
cp ./exampe-bptr-manifest.json /bptr/exampe-bptr-manifest
source .venv/bin/activate
python -c "import truss_transfer; truss_transfer.lazy_data_resolve('./tmp_no_cache/test', 4)"
export BASETEN_FS_ENABLED=True
python -c "import truss_transfer; truss_transfer.lazy_data_resolve('./tmp_fs_enabled/test', 32)"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@ yarn.lock
**/.chains_generated/**

.hypothesis

truss-transfer/target/
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "truss"
version = "0.9.59.rc0"
version = "0.9.59.rc0-013"
description = "A seamless bridge from model development to model delivery"
license = "MIT"
readme = "README.md"
Expand Down
Loading

0 comments on commit 1815db1

Please sign in to comment.