LLM plugin for running models using MLC
Project description
llm-mlc
LLM plugin for running models using MLC
Installation
Install this plugin in the same environment as llm
.
llm install llm-mlc
Next, run the llm mlc setup
command to complete the installation:
llm mlc setup
This will setup git lfs
and use it to install some extra dependencies:
Git LFS is not installed. Should I run 'git lfs install' for you?
Install Git LFS? [y/N]: y
Updated Git hooks.
Git LFS initialized.
Downloading prebuilt binaries...
Cloning into '/Users/simon/Library/Application Support/io.datasette.llm/mlc/dist/prebuilt/lib'...
remote: Enumerating objects: 221, done.
remote: Counting objects: 100% (86/86), done.
remote: Compressing objects: 100% (54/54), done.
remote: Total 221 (delta 59), reused 56 (delta 32), pack-reused 135
Receiving objects: 100% (221/221), 52.06 MiB | 9.13 MiB/s, done.
Resolving deltas: 100% (152/152), done.
Updating files: 100% (60/60), done.
Ready to install models in /Users/simon/Library/Application Support/io.datasette.llm/mlc
Finally, install the mlc_chat
package. This is a few extra steps, which are described in detail on the mlc.ai/package site.
If you are on an Apple Silicon M1/M2 Mac you can run this command:
llm mlc pip install --pre --force-reinstall \
mlc-ai-nightly \
mlc-chat-nightly \
-f https://mlc.ai/wheels
The llm mlc pip
command ensures that pip
will run in the same virtual environment as llm
itself.
For other systems, follow the instructions here.
Installing models
After installation you will need to download a model using the llm mlc download-model
command.
Here's how to download and install Llama 2:
llm mlc download-model Llama-2-7b-chat
This will download around 8GB of content.
You can also use Llama-2-13b-chat
or Llama-2-70b-chat
, though these files are a lot larger.
The download-model
command also takes a URL to one of the MLC repositories on Hugging Face.
For example, to install mlc-chat-WizardLM-13B-V1:
llm mlc download-model https://huggingface.co/mlc-ai/mlc-chat-WizardLM-13B-V1.2-q4f16_1
You can see a full list of models you have installed this way using:
llm mlc models
This will also show the name of the model you should use to activate it, e.g.:
MlcModel: mlc-chat-Llama-2-7b-chat-hf-q4f16_1
Running a prompt through a model
Once you have downloaded and added a model, you can run a prompt like this:
llm -m mlc-chat-Llama-2-7b-chat-hf-q4f16_1 \
'five names for a cute pet ferret'
Great! Here are five cute and creative name suggestions for a pet ferret:
- Ferbie - a playful and affectionate name for a friendly and outgoing ferret.
- Mr. Whiskers - a suave and sophisticated name for a well-groomed and dignified ferret.
- Luna - a celestial and dreamy name for a curious and adventurous ferret.
- Felix - a cheerful and energetic name for a lively and mischievous ferret.
- Sprinkles - a fun and playful name for a happy and energetic ferret with a sprinkle of mischief.
Remember, the most important thing is to choose a name that you and your ferret will love and enjoy!
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd llm-mlc
python3 -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file llm-mlc-0.2.tar.gz
.
File metadata
- Download URL: llm-mlc-0.2.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c40092fd470f7e6b4cef448b014b3de4bc6f720f093a6a06b5e537cd89f8e07f |
|
MD5 | 0c3cdeca05c872caf27624131008b57d |
|
BLAKE2b-256 | cef896274b00fa8ffc16538d24c13cd0ea1e1cf7bcc317040e9d673f02736b9c |
File details
Details for the file llm_mlc-0.2-py3-none-any.whl
.
File metadata
- Download URL: llm_mlc-0.2-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36ab043b2229d899156acc5dc5c05ecfeaf6afbd8f9f077d2c7f0f54306ba6db |
|
MD5 | 06575d68b49e4efbd4f2fdc38b977bf9 |
|
BLAKE2b-256 | 14c8e3ba82474f50e41e2d39b9676380da12aa71d9b603cda903a6ca61fbfdf9 |