-
Notifications
You must be signed in to change notification settings - Fork 30
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
Showing
25 changed files
with
1,121 additions
and
146 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,35 @@ | ||
name: Deploy Documentation | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # or your default branch name | ||
pull_request: | ||
branches: | ||
- main # or your default branch name | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install mkdocs mkdocs-material mkdocstrings[python] mkdocs-autorefs mkdocs-git-revision-date-localized-plugin mkdocs-jupyter | ||
- name: Build documentation | ||
run: mkdocs build | ||
|
||
- name: Deploy to GitHub Pages | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./site |
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 |
---|---|---|
@@ -1,36 +1,41 @@ | ||
name: Test PRs | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: macos-14 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
run: | | ||
brew install [email protected] | ||
python3 -m venv env | ||
source env/bin/activate | ||
- name: Run style checks | ||
run: | | ||
pip install pre-commit | ||
pre-commit run --all | ||
if ! git diff --quiet; then echo 'Style checks failed, please install pre-commit and run pre-commit run --all and push the change'; exit 1; fi | ||
- name: Install dependencies | ||
run: | | ||
pip install pytest | ||
pip install -e . | ||
- name: Run Python tests | ||
run: | | ||
pytest -s . | ||
test: | ||
runs-on: macos-14 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install MLX | ||
run: | | ||
pip install mlx>=0.15 | ||
- name: Install pre-commit | ||
run: | | ||
python -m pip install pre-commit | ||
pre-commit run --all | ||
if ! git diff --quiet; then | ||
echo 'Style checks failed, please install pre-commit and run pre-commit run --all and push the change' | ||
exit 1 | ||
fi | ||
- name: Install package and dependencies | ||
run: | | ||
python -m pip install pytest | ||
python -m pip install -e . | ||
- name: Run tests | ||
run: | | ||
pytest -s . |
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,67 @@ | ||
name: Update Changelog | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
update-changelog: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install requests python-dotenv | ||
- name: Update Changelog | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: python update_changelog.py | ||
- name: Commit changes | ||
run: | | ||
set -x # Enable verbose output | ||
echo "Configuring Git..." | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
echo "GitHub event name: ${{ github.event_name }}" | ||
echo "GitHub head ref: ${{ github.head_ref }}" | ||
echo "GitHub ref name: ${{ github.ref_name }}" | ||
echo "Fetching latest changes..." | ||
git fetch origin | ||
echo "Checking out and updating branch..." | ||
if [ "${{ github.event_name }}" = "pull_request" ]; then | ||
git checkout -B "${{ github.head_ref }}" "origin/${{ github.head_ref }}" | ||
git pull origin "${{ github.head_ref }}" | ||
else | ||
git checkout -B "${{ github.ref_name }}" "origin/${{ github.ref_name }}" | ||
git pull origin "${{ github.ref_name }}" | ||
fi | ||
echo "Current branch after checkout:" | ||
git branch | ||
echo "Running update script..." | ||
python update_changelog.py | ||
echo "Checking for changes..." | ||
git add docs/changelog.md | ||
git pull | ||
if git diff --staged --quiet; then | ||
echo "No changes to commit" | ||
else | ||
echo "Changes detected, committing..." | ||
git commit -m "Update changelog for latest release" | ||
echo "Pushing changes..." | ||
git push origin HEAD:"${{ github.head_ref || github.ref_name }}" || echo "Failed to push changes" | ||
fi | ||
echo "Final Git status:" | ||
git status |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.DS_Store | ||
__pycache__ | ||
*.egg-info | ||
venv/ | ||
env/ | ||
venv/* |
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 |
---|---|---|
@@ -1,11 +1,30 @@ | ||
# Changelog | ||
|
||
## v0.0.1 - Date | ||
## [v0.1.0] - 11 July 2024 | ||
|
||
**Improvement**: | ||
|
||
- TBD | ||
**What's Changed** | ||
|
||
- Add support for token streaming and custom CORS by [@Blaizzy](https://github.com/Blaizzy) | ||
- Add support for Parallel calls by [@Blaizzy](https://github.com/Blaizzy) | ||
- Add Parallel calls usage by [@Blaizzy](https://github.com/Blaizzy) | ||
|
||
**Fixes :** | ||
|
||
- Cross origin Support [#2](https://github.com/Blaizzy/fastmlx/issues/2) | ||
- Max tokens not overriding [#5](https://github.com/Blaizzy/fastmlx/issues/5) | ||
|
||
## [v0.0.1] - 09 July 2024 | ||
|
||
|
||
**What's Changed** | ||
|
||
- Setup FastMLX by [@Blaizzy](https://github.com/Blaizzy) | ||
- Add support for VLMs by [@Blaizzy](https://github.com/Blaizzy) | ||
- Add support for LMs by by [@Blaizzy](https://github.com/Blaizzy) | ||
|
||
**New Contributors** | ||
|
||
- [@Blaizzy](https://github.com/Blaizzy) made their first contribution in [https://github.com/Blaizzy/fastmlx/pull/1](https://github.com/Blaizzy/fastmlx/pull/1) | ||
|
||
**New Features**: | ||
|
||
- TBD |
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,84 @@ | ||
# CLI Reference | ||
|
||
The **FastMLX** API server can be configured using various command-line arguments. Here is a detailed reference for each available option. | ||
|
||
## Usage | ||
|
||
``` | ||
fastmlx [OPTIONS] | ||
``` | ||
|
||
## Options | ||
|
||
### `--allowed-origins` | ||
|
||
- **Type**: List of strings | ||
- **Default**: `["*"]` | ||
- **Description**: List of allowed origins for CORS (Cross-Origin Resource Sharing). | ||
|
||
### `--host` | ||
|
||
- **Type**: String | ||
- **Default**: `"0.0.0.0"` | ||
- **Description**: Host to run the server on. | ||
|
||
### `--port` | ||
|
||
- **Type**: Integer | ||
- **Default**: `8000` | ||
- **Description**: Port to run the server on. | ||
|
||
### `--reload` | ||
|
||
- **Type**: Boolean | ||
- **Default**: `False` | ||
- **Description**: Enable auto-reload of the server. Only works when 'workers' is set to None. | ||
|
||
### `--workers` | ||
|
||
- **Type**: Integer or Float | ||
- **Default**: Calculated based on `FASTMLX_NUM_WORKERS` environment variable or 2 if not set. | ||
- **Description**: Number of workers. This option overrides the `FASTMLX_NUM_WORKERS` environment variable. | ||
|
||
- If an integer, it specifies the exact number of workers to use. | ||
- If a float, it represents the fraction of available CPU cores to use (minimum 1 worker). | ||
- To use all available CPU cores, set it to 1.0. | ||
|
||
**Examples**: | ||
- `--workers 1`: Use 1 worker | ||
- `--workers 1.0`: Use all available CPU cores | ||
- `--workers 0.5`: Use half of the available CPU cores | ||
- `--workers 0.0`: Use 1 worker | ||
|
||
## Environment Variables | ||
|
||
- `FASTMLX_NUM_WORKERS`: Sets the default number of workers if not specified via the `--workers` argument. | ||
|
||
## Examples | ||
|
||
1. Run the server on localhost with default settings: | ||
``` | ||
fastmlx | ||
``` | ||
|
||
2. Run the server on a specific host and port: | ||
``` | ||
fastmlx --host 127.0.0.1 --port 5000 | ||
``` | ||
|
||
3. Run the server with 4 workers: | ||
``` | ||
fastmlx --workers 4 | ||
``` | ||
|
||
4. Run the server using half of the available CPU cores: | ||
``` | ||
fastmlx --workers 0.5 | ||
``` | ||
|
||
5. Enable auto-reload (for development): | ||
``` | ||
fastmlx --reload | ||
``` | ||
|
||
Remember that the `--reload` option is intended for development purposes and should not be used in production environments. |
This file was deleted.
Oops, something went wrong.
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,21 @@ | ||
Here are some projects built by the community that use FastMLX: | ||
|
||
1. FastMLX-MineCraft by Mathieu | ||
2. MLX Chat by Nils Durner | ||
3. AI Home Hub by Prince Canuma | ||
|
||
|
||
### PROJECTS IN DETAIL | ||
#### [FastMLX-MineCraft](https://x.com/mwrites__/status/1837465176582353080) by [Mathieu](https://x.com/mwrites__) | ||
|
||
<img src="https://pbs.twimg.com/media/GYMsGnaXUAA_Ga5?format=jpg&name=medium" alt="Remote image" width="400"> | ||
|
||
####[MLX Chat](https://github.com/ndurner/mlx_chat) by [Nils Durner](https://github.com/ndurner) | ||
Chat interface for MLX for on-device Language Model use on Apple Silicon. Built on FastMLX. | ||
|
||
![MLX Chat](./mlxchat.png) | ||
|
||
####[Home Hub](https://x.com/Prince_Canuma/status/1813689110089101623) by [Prince Canuma](https://x.com/Prince_Canuma) | ||
Turning your Mac into an AI home server. | ||
|
||
![AI Home Hub](./homehub.png) |
Oops, something went wrong.