Skip to content

Commit

Permalink
Merge pull request #82 from unum-cloud/main-dev
Browse files Browse the repository at this point in the history
JavaScript & Swift SDK
  • Loading branch information
ashvardanian authored Apr 25, 2024
2 parents 6358d94 + 4edede4 commit d670500
Show file tree
Hide file tree
Showing 53 changed files with 7,059 additions and 2,739 deletions.
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

0 comments on commit d670500

Please sign in to comment.