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

Add Docs #19

Merged
merged 35 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
74fbd35
add docs and update docstrings
Blaizzy Jul 16, 2024
c6bcbf6
add auto update changelong
Blaizzy Jul 16, 2024
0a0831d
remove semver
Blaizzy Jul 16, 2024
09c6fb4
add condition to release
Blaizzy Jul 16, 2024
4d44fba
remove changelog
Blaizzy Jul 16, 2024
82b89eb
change token
Blaizzy Jul 16, 2024
af39cdf
test commit changes
Blaizzy Jul 16, 2024
71c03b3
test push
Blaizzy Jul 16, 2024
3b58919
add checkout
Blaizzy Jul 16, 2024
acb6f51
formatting
Blaizzy Jul 16, 2024
94abf48
formatting
Blaizzy Jul 16, 2024
f7a1acc
formatting
Blaizzy Jul 16, 2024
f1c44a4
formatting
Blaizzy Jul 16, 2024
b88e572
add fetch
Blaizzy Jul 16, 2024
1085c36
fix fetch
Blaizzy Jul 16, 2024
be269de
Update changelog for latest release
actions-user Jul 16, 2024
6bfa1f2
remove test
Blaizzy Jul 16, 2024
a4f75b2
Merge branch 'pc/docs' of https://github.com/Blaizzy/fastmlx into pc/…
Blaizzy Jul 16, 2024
376d41a
deploy docs
Blaizzy Jul 16, 2024
403af15
fix requirements
Blaizzy Jul 16, 2024
d74f443
add git revision
Blaizzy Jul 16, 2024
28f785e
add mkdocs jupyter
Blaizzy Jul 16, 2024
c75a53b
add cli reference
Blaizzy Jul 16, 2024
bba0576
remove docstring
Blaizzy Jul 16, 2024
8b9443f
add repo name and remove edit_uri
Blaizzy Jul 16, 2024
4f25670
remove docstring and reformat
Blaizzy Jul 28, 2024
1f96d09
New Docs
Charmaineem Sep 9, 2024
83b1ed6
New Dovs
Charmaineem Sep 9, 2024
fb1148e
Fastmlx docs v01
Oct 27, 2024
5014cf4
Delete venv directory
Charmaineem Oct 27, 2024
101ad7f
Merge branch 'main' into pc/docs
Blaizzy Oct 27, 2024
dc96dea
v01
Oct 27, 2024
6f7e913
black
Charmaineem Oct 28, 2024
884fbc1
patch tests
Blaizzy Oct 28, 2024
7307a5f
tests fix 2
Blaizzy Oct 28, 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
35 changes: 35 additions & 0 deletions .github/workflows/deploy-docs.yml
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
67 changes: 67 additions & 0 deletions .github/workflows/update_changelog.yml
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 "action@github.com"
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
29 changes: 24 additions & 5 deletions docs/changelog.md
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
84 changes: 84 additions & 0 deletions docs/cli_reference.md
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.
3 changes: 0 additions & 3 deletions docs/common.md

This file was deleted.

21 changes: 21 additions & 0 deletions docs/community_projects.md
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. 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.

![Home Hub](./homehub.png)
72 changes: 38 additions & 34 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Contributing
# Join us in making a difference!

Contributions are welcome, and they are greatly appreciated! Every
little bit helps, and credit will always be given.
Your contributions are always welcome and we would love to see how you can make our project even better. Your input is invaluable to us, and we ensure that all contributors receive recognition for their efforts.

You can contribute in many ways:
## Ways to contribute

## Types of Contributions
Here’s how you can get involved:

### Report Bugs

Expand All @@ -19,81 +18,86 @@ If you are reporting a bug, please include:

### Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with `bug` and
`help wanted` is open to whoever wants to implement it.
Look through the GitHub issues for bugs. Anything tagged with `bug` and `help wanted` is open to whoever wants to implement it.

### Implement Features

Look through the GitHub issues for features. Anything tagged with
`enhancement` and `help wanted` is open to whoever wants to implement it.
Look through the GitHub issues for features. If anything tagged `enhancement` and `help wanted` catches your eye, dive in and start coding. Your ideas can become a reality in FastMLX!

### Write Documentation

fastmlx could always use more documentation,
whether as part of the official fastmlx docs,
in docstrings, or even on the web in blog posts, articles, and such.
We’re always in need of more documentation, whether it’s for our official docs, adding helpful comments in the code, or writing blog posts and articles. Clear and comprehensive documentation empowers the community, and your contributions are crucial!

### Submit Feedback

The best way to send feedback is to file an issue at
<https://github.com/Blaizzy/fastmlx/issues>.
The best way to share your thoughts is by filing an issue on our GitHub page: <https://github.com/Blaizzy/fastmlx/issues>. Whether you’re suggesting a new feature or sharing your experience, we want to hear from you!

If you are proposing a feature:
Proposing a feature?

- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
- Describe in detail how it should work.
- Keep it focused and manageable to make implementation smoother.
- Remember, this is a volunteer-driven project, and your contributions are always appreciated!

## Get Started!
## How to get Started!

Ready to contribute? Here's how to set up fastmlx for local development.
Ready to contribute? Follow these simple steps to set up FastMLX for local development and start making a difference.

1. Fork the fastmlx repo on GitHub.
1. Fork the repository.
- Head over to the [fastmlx GitHub repo](<https://github.com/Blaizzy/fastmlx/>) and click the Fork button to create your copy of the repository.

2. Clone your fork locally:
2. Clone your fork locally
- Open your terminal and run the following command to clone your forked repository:

```shell
$ git clone git@github.com:your_name_here/fastmlx.git
```

3. Install your local copy into a virtualenv. Assuming you have
virtualenvwrapper installed, this is how you set up your fork for
local development:

3. Set Up Your Development Environment
- Install your local copy of FastMLX into a virtual environment. If you’re using `virtualenvwrapper`, follow these steps:

```shell
$ mkvirtualenv fastmlx
$ cd fastmlx/
$ python setup.py develop
```

4. Create a branch for local development:
Tip: If you don’t have `virtualenvwrapper` installed, you can install it with `pip install virtualenvwrapper`.

4. Create a Development Branch
- Create a new branch to work on your bugfix or feature:

```shell
$ git checkout -b name-of-your-bugfix-or-feature
```

Now you can make your changes locally.
Now you’re ready to make changes!

5. Run Tests and Code Checks

5. When you're done making changes, check that your changes pass flake8
- When you're done making changes, check that your changes pass flake8
and the tests, including testing other Python versions with tox:

```shell
$ flake8 fastmlx tests
$ python setup.py test or pytest
$ tox
$ pytest .
```

To get flake8 and tox, just pip install them into your virtualenv.
- To install flake8 and tox, simply run:
```
pip install flake8 tox
```

6. Commit your changes and push your branch to GitHub:
6. Commit and Push Your Changes
- Once everything looks good, commit your changes with a descriptive message:

```shell
$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature
```

7. Submit a pull request through the GitHub website.
7. Submit a Pull Request
- Head back to the FastMLX GitHub repo and open a pull request. We’ll review your changes, provide feedback, and merge them once everything is ready.

## Pull Request Guidelines

Expand Down
4 changes: 4 additions & 0 deletions docs/endpoints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# Endpoints

::: fastmlx
Loading