forked from openai/tiktoken
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1a9f16
commit 1f098ca
Showing
9 changed files
with
122 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Build wheels | ||
|
||
on: [push, pull_request, workflow_dispatch] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build_wheels: | ||
name: py${{ matrix.python-version }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# cibuildwheel builds linux wheels inside a manylinux container | ||
# it also takes care of procuring the correct python version for us | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
python-version: [39, 310, 311] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: pypa/[email protected] | ||
env: | ||
CIBW_BUILD: "cp${{ matrix.python-version}}-*" | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist | ||
path: ./wheelhouse/*.whl | ||
|
||
build_sdist: | ||
name: sdist | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
name: Install Python | ||
with: | ||
python-version: "3.9" | ||
- name: Run check-manifest | ||
run: | | ||
pip install check-manifest | ||
check-manifest -v | ||
- name: Build sdist | ||
run: | | ||
pip install --upgrade build | ||
python -m build --sdist | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist | ||
path: ./dist/*.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
public = True | ||
|
||
if public: | ||
version = "0.1" | ||
version = "0.1.1" | ||
|
||
setup( | ||
name="tiktoken", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import tiktoken | ||
|
||
|
||
def test_simple(): | ||
enc = tiktoken.get_encoding("gpt2") | ||
assert enc.encode("hello world") == [31373, 995] | ||
assert enc.decode([31373, 995]) == "hello world" | ||
|
||
enc = tiktoken.get_encoding("cl100k_base") | ||
assert enc.encode("hello world") == [15339, 1917] | ||
assert enc.decode([15339, 1917]) == "hello world" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters