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

feat: Add MLX Manifold Pipeline #139

Merged
merged 12 commits into from
Jul 3, 2024
Merged

Conversation

justinh-rahb
Copy link
Collaborator

@justinh-rahb justinh-rahb commented Jun 30, 2024

Introducing the MLX Manifold Pipeline (v2.0)

This PR introduces a significant enhancement to the MLX pipeline with the MLX Manifold Pipeline, located in a new file: mlx_manifold_pipeline.py. This new pipeline offers major improvements:

Manifold Support:

  • The pipeline automatically detects and lists all available HF models with a defined filter keyword.
  • This removes the need for manual model configuration and makes model selection easier.

Dynamic Model Loading:

  • The pipeline dynamically loads and uses the selected MLX model when run.
  • This eliminates static model definitions and allows for more flexible model experimentation and deployment.

Version 2.0:

  • This update is a major version bump (v2.0) due to the substantial changes introduced.
  • The existing MLX pipeline remains untouched to ensure backward compatibility.

Migration:

  • Users can switch to mlx_manifold_pipeline.py to use the new Manifold Pipeline, but should not run both on the same MLX backend server.

Testing:

  • The MLX Manifold Pipeline needs more thorough testing before merging, help wanted!

Using the Valves:

  • MLX Model Filter: Filter available models to show only ones matching the filter keyword.
  • MLX Default Model: Set a default model to be automatically loaded.
    • If not found locally, it will be downloaded (similar to Ollama's pull feature).
  • MLX Stop: Define stop words that will trigger the inference to end.
  • MLX Chat Template: Specify a custom chat template to use.
  • MLX Use Default Chat Template: True/False (default False)
  • HuggingFace Token: Provide your token for accessing private models.

Note: Setting an environment variable for your HuggingFace cache can point to an alternate model location, bypassing the need for the MLX Model Pattern filter.


This enhancement makes the MLX pipeline more usable and flexible, allowing users to better utilize their MLX models.

@justinh-rahb justinh-rahb marked this pull request as draft June 30, 2024 05:28
@tjbck
Copy link
Collaborator

tjbck commented Jun 30, 2024

Can't wait to try this 🤩 Thanks!

@justinh-rahb
Copy link
Collaborator Author

Forgot the teasers 😬

Screenshot 2024-06-30 at 1 40 29 AM Screenshot 2024-06-30 at 1 36 43 AM
Screen.Recording.2024-06-30.at.12.23.31.AM.mp4

@justinh-rahb
Copy link
Collaborator Author

justinh-rahb commented Jun 30, 2024

TODO for MLX Manifold Pipeline PR:

  • Remove MLX_SUBPROCESS=False option: This is essential for the dynamic model loading. DONE
  • Cleanup/Rename Valves: Improve clarity by cleaning up and renaming some Valves. DONE
  • Consider a helper script: Explore creating a script that simplifies installation and running of the MLX Pipelines server on macOS.
  • Investigate mlx_lm direct usage (v2.0 ONLY): Since MLX_SUBPROCESS=False is being removed in v2.0, directly using the mlx_lm library instead of mlx_lm.serve might be possible and more efficient. This needs further investigation.
  • Document containerization limitations: Running Pipelines on bare metal is required due to the removal of the subprocess option.

@justinh-rahb justinh-rahb marked this pull request as ready for review July 3, 2024 14:53
@justinh-rahb justinh-rahb marked this pull request as draft July 3, 2024 15:00
@justinh-rahb justinh-rahb marked this pull request as ready for review July 3, 2024 15:13
@tjbck
Copy link
Collaborator

tjbck commented Jul 3, 2024

Let's goooooo 🚀

@tjbck tjbck merged commit 98604da into open-webui:main Jul 3, 2024
@justinh-rahb justinh-rahb deleted the mlx-manifold branch July 4, 2024 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants