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

Support local model with inference-engine mlx #475

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

OKHand-Zy
Copy link

@OKHand-Zy OKHand-Zy commented Nov 20, 2024

Enhancement: support local and custom models #165

This is a modified version of my existing code, although the code quality may not be ideal. It supports running local path models using mlx for both CLI and ChatAPI. (For now, you still need to manually place the model into the ~/.cache/exo directory before use. I'm working on automating this, but my unfamiliarity with grpc requires further research.)

I would greatly appreciate any suggestions on how to improve or optimize the code for better results.

Changes:

  • Added a "How to use local models" section to the README.
  • Implemented init_exo_env to configure local model cards and the local model store.
  • Added bypass logic for local models using if...else statements.

@blindcrone
Copy link
Contributor

I like the idea here, but think rather than rely on a folder structure this should use config files or command line arguments to specify paths to model implementations and populate things like the model card list at runtime. I'm considering refactoring the inference engine to take model implementations by default and use the shard downloader as one of a few possible routes to get weights, and I think automatically instantiating and parsing a default directory structure for this purpose creates a lot of potential for issues down the line

@OKHand-Zy
Copy link
Author

OKHand-Zy commented Nov 22, 2024

@blindcrone
Recently, while implementing the HTTP functionality for the local model, I realized what you meant. I've switched to using aiohttp to establish an HTTP service on each node. When needed, I'll check which node has the necessary data and use an internal network to download it in chunks (similar to how exo does it). Afterward, I'll rely on the inference_engine in the command to use the model, instead of configuring it through a config file. I'm wondering if this aligns with your thoughts? If there's a better approach, I'm open to suggestions.

@OKHand-Zy OKHand-Zy marked this pull request as draft November 27, 2024 15:35
@OKHand-Zy OKHand-Zy marked this pull request as ready for review December 6, 2024 07:49
@OKHand-Zy
Copy link
Author

OKHand-Zy commented Dec 24, 2024

New Updates:

  • Automatic broadcasting of local model downloads is now supported.
  • Added --stored-model-ip and --stored-model-port arguments.
  • CLI and ChatAPI now support running local models.
  • Added a 'storedhost' directory within the download directory for local model code.
  • Added instructions on how to run local models to the README.

Note: This feature only supports the --inference-engine mlx option.

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.

2 participants