Skip to content

Commit

Permalink
Merge pull request #1 from Picovoice/initial-python
Browse files Browse the repository at this point in the history
Python Actions Testin
  • Loading branch information
ErisMik authored Apr 11, 2024
2 parents df185c9 + 096e570 commit 1ec1d2c
Show file tree
Hide file tree
Showing 80 changed files with 2,377 additions and 0 deletions.
94 changes: 94 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Bug report
description: Bugs in picoLLM
title: "picoLLM Issue: "
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
**Before** reporting an issue, make sure to read the [documentation](https://picovoice.ai/docs/picollm/) and search [existing issues](https://github.com/Picovoice/picollm/issues).
- type: checkboxes
id: check
attributes:
label: Have you checked the docs and existing issues?
description: Make sure you have checked all of the below before submitting an issue
options:
- label: I have read all of the relevant Picovoice picoLLM docs
required: true
- label: I have searched the existing issues for picoLLM
required: true
- type: dropdown
id: sdk
attributes:
label: SDK
options:
- Android
- C
- iOS
- Python
- Rust
- Web
validations:
required: true
- type: input
id: package
attributes:
label: "picoLLM package version"
placeholder: "1.0.0"
validations:
required: true
- type: input
id: framework
attributes:
label: "Framework version"
placeholder: "Python 3.7, .NET Core 3.1, etc."
validations:
required: true
- type: dropdown
id: platform
attributes:
label: Platform
options:
- Android
- iOS
- Web (WASM)
- Linux (x86_64)
- macOS (x86_64, arm64)
- Windows (x86_64)
- Raspberry Pi
- NVIDIA Jetson
- BeagleBone
validations:
required: true
- type: input
id: os
attributes:
label: "OS/Browser version"
placeholder: "macOS 11.0, Android 8.0, etc."
validations:
required: true
- type: textarea
id: description
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1.
2.
3.
validations:
required: true
- type: textarea
id: expectation
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: true
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Documentation
description: Issues around documentation of picoLLM
title: "picoLLM Documentation Issue: "
labels: ["documentation"]
body:
- type: input
id: url
attributes:
label: What is the URL of the doc?
validations:
required: true
- type: textarea
id: issue
attributes:
label: What is the nature of the issue?
description: e.g. steps do not work, typos/grammar/spelling, out of date, etc.
validations:
required: true
34 changes: 34 additions & 0 deletions .github/workflows/python-codestyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Python Codestyle

on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- 'binding/python/*.py'
- 'demo/python/*.py'
- '.github/workflows/python-codestyle.yml'
pull_request:
branches: [ main, 'v[0-9]+.[0-9]+' ]
paths:
- 'binding/python/*.py'
- 'demo/python/*.py'
- '.github/workflows/python-codestyle.yml'

jobs:
check-python-codestyle:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: pip install flake8 pep8-naming

- name: Check python codestyle
run: flake8 --ignore=F401,F403,F405 --max-line-length=120 binding/python demo/python
62 changes: 62 additions & 0 deletions .github/workflows/python-demos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Python Demos

on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- '.github/workflows/python-demos.yml'
- 'demo/python/**'
- '!demo/python/README.md'
pull_request:
branches: [ main, 'v[0-9]+.[0-9]+' ]
paths:
- '.github/workflows/python-demos.yml'
- 'demo/python/**'
- '!demo/python/README.md'

defaults:
run:
working-directory: demo/python

jobs:
build-self-hosted:
runs-on: ${{ matrix.machine }}

strategy:
fail-fast: false
matrix:
machine: [rpi4-32, rpi4-64, rpi5-32, rpi5-64, pv-linux, pv-ios, pv-windows]

steps:
- uses: actions/checkout@v3

- name: Setup Python virtualenv (*nix)
if: ${{ matrix.machine != 'pv-windows' }}
run: |
python3 -m venv .venv
. .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Setup Python virtualenv (windows)
if: ${{ matrix.machine == 'pv-windows' }}
run: |
python3 -m venv .venv
.venv\Scripts\activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Build dependencies
run: |
python3 -m pip install setuptools wheel
cd ../../binding/python
python3 setup.py sdist bdist_wheel
python3 -m pip install --force-reinstall dist/pvpicollm-0.1.0-py3-none-any.whl
- name: Install Python dependencies
run: python3 -m pip install -r requirements.txt

- name: Download resource files
run: curl http://${{secrets.PV_CICD_RES_SERVER_AUTHORITY}}/github/picollm/res/phi2-290.bin/latest/phi2-290.bin -o phi2-290.bin

- name: Test
run: python3 picollm_demo.py --access_key ${{secrets.PV_VALID_ACCESS_KEY}} --model_path phi2-290.bin --completion_token_limit 10 --generate Hello my name is
69 changes: 69 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Python

on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- '.github/workflows/python.yml'
- 'binding/python/**'
- '!binding/python/README.md'
- 'lib/beaglebone/**'
- 'lib/jetson/**'
- 'lib/linux/**'
- 'lib/mac/**'
- 'lib/raspberry-pi/**'
- 'lib/windows/**'
- 'res/audio/**'
pull_request:
branches: [ main, 'v[0-9]+.[0-9]+' ]
paths:
- '.github/workflows/python.yml'
- 'binding/python/**'
- '!binding/python/README.md'
- 'lib/beaglebone/**'
- 'lib/jetson/**'
- 'lib/linux/**'
- 'lib/mac/**'
- 'lib/raspberry-pi/**'
- 'lib/windows/**'
- 'res/audio/**'

defaults:
run:
working-directory: binding/python

jobs:
build-self-hosted:
runs-on: ${{ matrix.machine }}

strategy:
fail-fast: false
matrix:
machine: [rpi4-32, rpi4-64, rpi5-32, rpi5-64, pv-linux, pv-ios, pv-windows]

steps:
- uses: actions/checkout@v3

- name: Setup Python virtualenv (*nix)
if: ${{ matrix.machine != 'pv-windows' }}
run: |
python3 -m venv .venv
. .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Setup Python virtualenv (windows)
if: ${{ matrix.machine == 'pv-windows' }}
run: |
python3 -m venv .venv
.venv\Scripts\activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Install Python dependencies
run: python3 -m pip install -r requirements.txt

- name: Download resource files
run: curl http://${{secrets.PV_CICD_RES_SERVER_AUTHORITY}}/github/picollm/res/phi2-290.bin/latest/phi2-290.bin -o phi2-290.bin

- name: Test
run: python3 test_picollm.py ${{secrets.PV_VALID_ACCESS_KEY}} ./phi2-290.bin
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
.idea
__pycache__
*.bin
Loading

0 comments on commit 1ec1d2c

Please sign in to comment.