outlinesmlx


Nameoutlinesmlx JSON
Version 0.0.271 PyPI version JSON
download
home_page
SummaryProbabilistic Generative Model Programming
upload_time2024-02-09 17:22:41
maintainer
docs_urlNone
authorSacha Ichbiah
requires_python>=3.8
license
keywords machine learning deep learning language models guided generation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # outlinesmlx

`outlinesmlx` is a minimalistic library aimed at adapting the Outlines library for use with the MLX framework.

To install, use: `pip install outlinesmlx`.

[Outlines](https://github.com/outlines-dev/outlines/) provides methods to control the generation of language models to make their output more predictable. Combined with [MLX](https://github.com/ml-explore/mlx), it enables guided generation with large language models while leveraging Apple Silicon hardware.

<img src="https://raw.githubusercontent.com/sacha-ichbiah/outlines-mlx/main/logo.png" alt="Outlines-MLX" width=300></img>

## Design Principles

We designed it as an adapter that replaces the PyTorch parts of the original Outlines library with MLX compatible components. We will continue to update it actively as Outlines evolves over time.

### Versioning

`outlinesmlx-x` is the MLX adapter for `outlines-x`. Versions can easily be checked with :

```bash
pip list | grep outlines
```

## Why Outlines MLX?

We believe that guided generation is an important technology that will define the future of AI applications beyond chatbots. As Apple Silicon chips become increasingly powerful, we aim to extend guided-generation capabilities to a whole new family of devices. The original [Outlines](https://github.com/outlines-dev/outlines/) library relies on PyTorch, and adapting it to MLX requires changing many key components.

## Installation

`outlinesmlx` can be installed directly from the PyPI repository:

```bash
pip install outlinesmlx
```

## Supported Models

The models are imported using the library [mlx-lm](https://github.com/ml-explore/mlx-examples/tree/main/llms/).

This allows for seamless importation of quantized models. You can import any model from the HuggingFace hub using this library.

### Load Model with an MLX Backend

Refer to the examples folder and the original [Outlines](https://github.com/outlines-dev/outlines/) library for more use cases.

```python
import outlinesmlx as outlines

model = outlines.models.mlx("mlx-community/Mistral-7B-Instruct-v0.1-4bit-mlx")

prompt = """You are a sentiment-labelling assistant.
Is the following review positive or negative?

Review: This restaurant is just awesome!
"""
answer = outlines.generate.choice(model, ["Positive", "Negative"])(prompt)
```

### Disclaimer

This library is maintained on a monthly basis. Due to the rapid evolution of the MLX framework and the original Outlines library, it may not be up-to-date with their latest advancements. `outlinesmlx` is designed for experiments with guided generation on Apple Silicon. Please refer to the original [Outlines](https://github.com/outlines-dev/outlines/) library for an up-to-date implementation.

`outlinesmlx` is only compatible with MLX models. If you wish to perform guided generation using transformers or other architectures, please use the original [Outlines](https://github.com/outlines-dev/outlines/) library.

### Contributions

We welcome external contributions!

### Citation

Please do not forget to cite the original paper:

```bibtex
@article{willard2023efficient,
  title={Efficient Guided Generation for LLMs},
  author={Willard, Brandon T and Louf, R{\'e}mi},
  journal={arXiv preprint arXiv:2307.09702},
  year={2023}
}
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "outlinesmlx",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "machine learning,deep learning,language models,guided generation",
    "author": "Sacha Ichbiah",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/c8/0d/c35281a489f383da5d0c6a1fb026a9110135b69bfb60ecd18f1ff0a94929/outlinesmlx-0.0.271.tar.gz",
    "platform": null,
    "description": "# outlinesmlx\n\n`outlinesmlx` is a minimalistic library aimed at adapting the Outlines library for use with the MLX framework.\n\nTo install, use: `pip install outlinesmlx`.\n\n[Outlines](https://github.com/outlines-dev/outlines/) provides methods to control the generation of language models to make their output more predictable. Combined with [MLX](https://github.com/ml-explore/mlx), it enables guided generation with large language models while leveraging Apple Silicon hardware.\n\n<img src=\"https://raw.githubusercontent.com/sacha-ichbiah/outlines-mlx/main/logo.png\" alt=\"Outlines-MLX\" width=300></img>\n\n## Design Principles\n\nWe designed it as an adapter that replaces the PyTorch parts of the original Outlines library with MLX compatible components. We will continue to update it actively as Outlines evolves over time.\n\n### Versioning\n\n`outlinesmlx-x` is the MLX adapter for `outlines-x`. Versions can easily be checked with :\n\n```bash\npip list | grep outlines\n```\n\n## Why Outlines MLX?\n\nWe believe that guided generation is an important technology that will define the future of AI applications beyond chatbots. As Apple Silicon chips become increasingly powerful, we aim to extend guided-generation capabilities to a whole new family of devices. The original [Outlines](https://github.com/outlines-dev/outlines/) library relies on PyTorch, and adapting it to MLX requires changing many key components.\n\n## Installation\n\n`outlinesmlx` can be installed directly from the PyPI repository:\n\n```bash\npip install outlinesmlx\n```\n\n## Supported Models\n\nThe models are imported using the library [mlx-lm](https://github.com/ml-explore/mlx-examples/tree/main/llms/).\n\nThis allows for seamless importation of quantized models. You can import any model from the HuggingFace hub using this library.\n\n### Load Model with an MLX Backend\n\nRefer to the examples folder and the original [Outlines](https://github.com/outlines-dev/outlines/) library for more use cases.\n\n```python\nimport outlinesmlx as outlines\n\nmodel = outlines.models.mlx(\"mlx-community/Mistral-7B-Instruct-v0.1-4bit-mlx\")\n\nprompt = \"\"\"You are a sentiment-labelling assistant.\nIs the following review positive or negative?\n\nReview: This restaurant is just awesome!\n\"\"\"\nanswer = outlines.generate.choice(model, [\"Positive\", \"Negative\"])(prompt)\n```\n\n### Disclaimer\n\nThis library is maintained on a monthly basis. Due to the rapid evolution of the MLX framework and the original Outlines library, it may not be up-to-date with their latest advancements. `outlinesmlx` is designed for experiments with guided generation on Apple Silicon. Please refer to the original [Outlines](https://github.com/outlines-dev/outlines/) library for an up-to-date implementation.\n\n`outlinesmlx` is only compatible with MLX models. If you wish to perform guided generation using transformers or other architectures, please use the original [Outlines](https://github.com/outlines-dev/outlines/) library.\n\n### Contributions\n\nWe welcome external contributions!\n\n### Citation\n\nPlease do not forget to cite the original paper:\n\n```bibtex\n@article{willard2023efficient,\n  title={Efficient Guided Generation for LLMs},\n  author={Willard, Brandon T and Louf, R{\\'e}mi},\n  journal={arXiv preprint arXiv:2307.09702},\n  year={2023}\n}\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Probabilistic Generative Model Programming",
    "version": "0.0.271",
    "project_urls": {
        "repository": "https://github.com/sacha-ichbiah/outlines-mlx/"
    },
    "split_keywords": [
        "machine learning",
        "deep learning",
        "language models",
        "guided generation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f86aadcb5dffdfd731d5fa3ae10060111c85ecbd2fcc9a94ff1d9bc41006f506",
                "md5": "875e3c53647f94da1d64c1a2d193d9e3",
                "sha256": "d71e80f2186bf49482581a0771e5c256bedc7029d4f5a4877971bc84de7d7864"
            },
            "downloads": -1,
            "filename": "outlinesmlx-0.0.271-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "875e3c53647f94da1d64c1a2d193d9e3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10686,
            "upload_time": "2024-02-09T17:22:40",
            "upload_time_iso_8601": "2024-02-09T17:22:40.095033Z",
            "url": "https://files.pythonhosted.org/packages/f8/6a/adcb5dffdfd731d5fa3ae10060111c85ecbd2fcc9a94ff1d9bc41006f506/outlinesmlx-0.0.271-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c80dc35281a489f383da5d0c6a1fb026a9110135b69bfb60ecd18f1ff0a94929",
                "md5": "b6a6d423c60326611cddd25dcd385134",
                "sha256": "9580999cf5290c772e72d5fdfecbc0ef113e0042c0535e7250cba3f1c0e5e6a4"
            },
            "downloads": -1,
            "filename": "outlinesmlx-0.0.271.tar.gz",
            "has_sig": false,
            "md5_digest": "b6a6d423c60326611cddd25dcd385134",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 83142,
            "upload_time": "2024-02-09T17:22:41",
            "upload_time_iso_8601": "2024-02-09T17:22:41.898183Z",
            "url": "https://files.pythonhosted.org/packages/c8/0d/c35281a489f383da5d0c6a1fb026a9110135b69bfb60ecd18f1ff0a94929/outlinesmlx-0.0.271.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-09 17:22:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sacha-ichbiah",
    "github_project": "outlines-mlx",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "outlinesmlx"
}
        
Elapsed time: 0.20948s