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

JavaScript & Swift SDK #82

Merged
merged 57 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
2246f13
Improve: Fetch modalities separately
ashvardanian Apr 16, 2024
b310e90
Fix: Compatibility with older models
ashvardanian Apr 16, 2024
a2f77d2
Make: Rename files
ashvardanian Apr 16, 2024
30d40a0
Merge branch 'main-dev' of https://github.com/unum-cloud/uform into m…
ashvardanian Apr 16, 2024
acbb77a
Add: Placeholder for JavaScript SDK
ashvardanian Apr 16, 2024
2351fe9
Docs: Improve export process
ashvardanian Apr 16, 2024
bb7ca9d
Merge branch 'main-dev'
ashvardanian Apr 16, 2024
38949f3
Merge branch 'main' of https://github.com/ashvardanian/uform
ashvardanian Apr 16, 2024
94ebd6e
Break: Deprecate old ONNX structure
ashvardanian Apr 17, 2024
479ae61
Improve: Support different models with Swift
ashvardanian Apr 17, 2024
45479bd
Add: JavaScript library placeholder
ashvardanian Apr 18, 2024
a2e1a86
Merge branch 'main' of https://github.com/ashvardanian/uform
ashvardanian Apr 18, 2024
2f81413
Make: Consistent naming between Python and TS
ashvardanian Apr 18, 2024
eb88296
Improve: Separate text and image processors
ashvardanian Apr 18, 2024
a391b6d
Make: Deprecate TypeScript for JavaScript
ashvardanian Apr 18, 2024
50c71c8
Add: Text processor for JS
ashvardanian Apr 19, 2024
19c0c30
Fix: Mismatch in the input types for text
ashvardanian Apr 19, 2024
7ac33bd
Fix: Passing tests in JavaScript
ashvardanian Apr 19, 2024
4f1568f
Fix: Rename image inputs
ashvardanian Apr 20, 2024
cccfc62
Improve: Separate encoders & processors
ashvardanian Apr 20, 2024
b790519
Improve: PAss tests for small models
ashvardanian Apr 20, 2024
605bfc8
Improve: Test more models
ashvardanian Apr 21, 2024
0c2aa28
Improve: Test many models in JS
ashvardanian Apr 21, 2024
766963c
Add: Text and image cross-referencing in JS
ashvardanian Apr 21, 2024
ffca7f6
Merge branch 'main' of https://github.com/ashvardanian/uform
ashvardanian Apr 21, 2024
6b3f8cd
Add: Initial decoder exporters
ashvardanian Apr 22, 2024
4c1ac18
Fix: Transposing channels in JS
ashvardanian Apr 23, 2024
9bf5fe3
Improve: Uniform APIs across JS, Py, and Swift
ashvardanian Apr 23, 2024
3e1e576
Improve: Error handling in Swift
ashvardanian Apr 23, 2024
18a3bb6
Merge branch 'main' of https://github.com/ashvardanian/uform
ashvardanian Apr 23, 2024
f8654b5
Improve: Image pre-processing in Swift
ashvardanian Apr 23, 2024
37d7f52
Improve: Hide temporary files
ashvardanian Apr 23, 2024
d82a1a1
Merge branch 'main' of https://github.com/ashvardanian/uform
ashvardanian Apr 23, 2024
67b083f
Improve: Pretty-print benchmarks
ashvardanian Apr 23, 2024
8e38b2e
Make: Add development dependencies
ashvardanian Apr 23, 2024
96df21d
Improve: Reduce warnings
ashvardanian Apr 23, 2024
91c86a1
Improve: Move inputs to same device as model
ashvardanian Apr 23, 2024
6d5f1ce
Docs: Reorganize
ashvardanian Apr 24, 2024
1f556b8
Improve: Extend benchmarks
ashvardanian Apr 24, 2024
47b7a49
Docs: Add examples
ashvardanian Apr 24, 2024
ebd7f66
Improve: Refresh CLI for new models
ashvardanian Apr 24, 2024
d00204f
Docs: Reference for Py and Swift
ashvardanian Apr 24, 2024
c6f773c
Docs: Typo
ashvardanian Apr 24, 2024
6d4b614
Improve: Backend-agnostic `.data` extraction in JS
ashvardanian Apr 24, 2024
cf25160
Fix: `add_special_tokens` argument in JS
ashvardanian Apr 24, 2024
917a4a8
Improve: Multi-GPU support in Py
ashvardanian Apr 24, 2024
f195b66
Add: Parallel decoding bench
ashvardanian Apr 25, 2024
f4b19a8
Merge branch 'main' of https://github.com/ashvardanian/uform
ashvardanian Apr 25, 2024
641b8c0
Merge pull request #81 from ashvardanian/main
ashvardanian Apr 25, 2024
937d7ad
Make: Test & Publish JS
ashvardanian Apr 25, 2024
9b56349
Make: Add Swift tests
ashvardanian Apr 25, 2024
60da962
Make: Indexing NPM `package-lock.json`
ashvardanian Apr 25, 2024
0af7cbf
Make: Upgrade MacOS runner
ashvardanian Apr 25, 2024
5ff26ad
Fix: Missing `switch` cases
ashvardanian Apr 25, 2024
4bef407
Make: Block failing JS tests
ashvardanian Apr 25, 2024
1b821cc
Merge branch 'main-dev' of https://github.com/unum-cloud/uform into m…
ashvardanian Apr 25, 2024
4edede4
Make: Take current branch
ashvardanian Apr 25, 2024
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
33 changes: 31 additions & 2 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ permissions:
contents: read

jobs:

test_python:
name: Test Python
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- run: git submodule update --init --recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand All @@ -34,5 +34,34 @@ jobs:
pip install -e ".[onnx]"
pip install pytest

# When running tests in CI, limit ourselves to the small model tests
- name: Test with PyTest
run: pytest python/scripts/ -s -x -Wd -v
run: pytest python/scripts/ -s -x -Wd -v -k small

test_javascript:
name: Test JavaScript
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20

# TODO: JavaScript tests pass, but ONNX throws a memory error on exit
# - name: Build JavaScript
# run: npm ci
# - name: Test JavaScript
# run: npm test

test_swift:
name: Test Swift
runs-on: macos-14

steps:
- uses: actions/checkout@v4
- name: Build
run: swift build
- name: Run tests
run: swift test
38 changes: 34 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Run PyTest
run: pytest python/scripts/

pypi_publish:
publish_python:
name: Publish Python
runs-on: ubuntu-latest
needs: versioning
Expand Down Expand Up @@ -101,22 +101,52 @@ jobs:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

publish_javascript:
name: Publish JavaScript
needs: versioning
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
with:
ref: "main"

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20

# TODO: JavaScript tests pass, but ONNX throws a memory error on exit
# - name: Build and Test
# run: |
# npm ci
# npm test

- name: Publish
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}

deploy_docs:
name: Deploy Docs
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
needs: pypi_publish
needs: [publish_python, publish_javascript]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: "main"
- name: Install dependencies
run: |
sudo apt update &&
sudo apt install -y doxygen graphviz dia git &&
pip install sphinx==5.3.0 sphinx-js==3.2.1 breathe==4.35.0 furo==2023.3.27 m2r2==0.3.3.post2 sphinxcontrib-googleanalytics==0.2.dev20220708 sphinxcontrib-jquery==4.1 &&
npm install -g jsdoc
- name: Setup GitHub Pages
uses: actions/configure-pages@v2
- name: Install dependencies
run: sudo apt update && sudo apt install -y doxygen graphviz dia git && pip install sphinx==7.1.2 breathe furo m2r2 sphinxcontrib-googleanalytics==0.2.dev20220708 sphinxcontrib-jquery toml
- name: Install UForm from PyPi
run: pip install uform
- name: Build documentation
Expand Down
29 changes: 22 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
requirements.txt
dist/
test
build/
package-lock.json
/requirements.txt
/dist/
/test
/build/
yarn.lock
*.egg-info
*.onnx
__pycache__
.build
.swiftpm
.swiftpm
.hf_token

dictionary*
vocab*
/models/

# Tensors & ML Model
*.onnx
*.pt
*.safetensors
*.mlpackage

# NodeJS
node_modules
node_build
yarn-error.log
20 changes: 19 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,29 @@
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File with Arguments",
"name": "Python Debugger",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
},
{
"name": "PyTest Debugger",
"type": "debugpy",
"request": "launch",
"program": "pytest",
"console": "integratedTerminal",
"args": [
"${file}",
"-s",
"-x",
],
},
{
"name": "NodeJS Debugger",
"type": "node-terminal",
"request": "launch",
"command": "npm run test",
}
]
}
17 changes: 15 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"cSpell.words": [
"arange",
"astype",
"CFURL",
"coreml",
"crossattn",
"cumsum",
"dtype",
"embs",
Expand All @@ -19,26 +21,37 @@
"ndarray",
"numpy",
"ONNX",
"onnxconverter",
"onnxruntime",
"opset",
"packbits",
"preprocess",
"pretrained",
"probs",
"pypi",
"pytest",
"randn",
"rerank",
"reranker",
"reranking",
"sandbeach",
"sess",
"SIMD",
"softmax",
"Tensorrt",
"torchvision",
"transfromers",
"uform",
"unimodal",
"unsqueeze",
"Vardanian"
"Vardanian",
"whitespaces"
],
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none"
"python.formatting.provider": "none",
"window.autoDetectColorScheme": true,
"workbench.colorTheme": "Default Dark+",
"workbench.preferredDarkColorTheme": "Default Dark+"
}
Loading
Loading