applm


Nameapplm JSON
Version 0.0.51 PyPI version JSON
download
home_pageNone
SummaryLanguage Model Tools for Apple Silicon
upload_time2024-08-14 03:55:54
maintainerNone
docs_urlNone
authorJonathan Dobson
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # AppLM

AppLM brings Language Model Tools to Apple Silicon.

This project aiming to refactor the [mlx-lm](https://pypi.org/project/mlx-lm/) package with a goal to reorganize it making the features less opinionated and more flexible for developer customization. For example, we are removing the CLI components, and exposing more of the package parts as an developer API.

Warning: This package is still incomplete.

Please do not use it yet in production.

This package was created August 13, 2024

## Install AppLM, Transformers, and MLX

```shell
pip install transformers mlx applm
```

## Generate

This is just the first test. We have only tested this one code example so far.

```python
from applm.utils.load import load
from applm.utils.generate import generate
import applm.models.qwen2 as qwen2

model_name = "mlx-community/Qwen2-0.5B"

model, tokenizer = load(
    model_name,
    tokenizer_config={"eos_token": "<|im_end|>"},
    mx_prototype=qwen2,
)

prompt = "Give me a short introduction to large language model."
messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": prompt},
]
input_text = ""
for message in messages:
    if message["role"] == "user":
        input_text = message["content"]
        break

response = generate(
    model,
    tokenizer,
    prompt=input_text,
    verbose=True,
    top_p=0.8,
    temp=0.7,
    repetition_penalty=1.05,
    max_tokens=512,
    mx_prototype=qwen2,
)

```

This example will soon change.

It is only meant to showcase the direction we are working toward. The next change to the `applm` package will probably break it.

If you like what we are doing, want to watch our progress, or want to contribute, please feel free to engage with the repo on github.

We are looking for contributors to help further develop this package.

The refactor is not complete, but we will make regular updates as we progress.

If you are the Apple developer in charge of leading the mlx-lm package development, and you also have the goal to refactor the mlx-lm package to be less opinionated and more developer customizable, feel free to use this package as inspiration, fork it, merge it, or collaborate either on this package or the mlx-lm package.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "applm",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Jonathan Dobson",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/79/fa/a62bddfc50fda63f2c4a75dd151cb6829133be08e8efc20ce2120462846e/applm-0.0.51.tar.gz",
    "platform": null,
    "description": "# AppLM\n\nAppLM brings Language Model Tools to Apple Silicon.\n\nThis project aiming to refactor the [mlx-lm](https://pypi.org/project/mlx-lm/) package with a goal to reorganize it making the features less opinionated and more flexible for developer customization. For example, we are removing the CLI components, and exposing more of the package parts as an developer API.\n\nWarning: This package is still incomplete.\n\nPlease do not use it yet in production.\n\nThis package was created August 13, 2024\n\n## Install AppLM, Transformers, and MLX\n\n```shell\npip install transformers mlx applm\n```\n\n## Generate\n\nThis is just the first test. We have only tested this one code example so far.\n\n```python\nfrom applm.utils.load import load\nfrom applm.utils.generate import generate\nimport applm.models.qwen2 as qwen2\n\nmodel_name = \"mlx-community/Qwen2-0.5B\"\n\nmodel, tokenizer = load(\n    model_name,\n    tokenizer_config={\"eos_token\": \"<|im_end|>\"},\n    mx_prototype=qwen2,\n)\n\nprompt = \"Give me a short introduction to large language model.\"\nmessages = [\n    {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n    {\"role\": \"user\", \"content\": prompt},\n]\ninput_text = \"\"\nfor message in messages:\n    if message[\"role\"] == \"user\":\n        input_text = message[\"content\"]\n        break\n\nresponse = generate(\n    model,\n    tokenizer,\n    prompt=input_text,\n    verbose=True,\n    top_p=0.8,\n    temp=0.7,\n    repetition_penalty=1.05,\n    max_tokens=512,\n    mx_prototype=qwen2,\n)\n\n```\n\nThis example will soon change.\n\nIt is only meant to showcase the direction we are working toward. The next change to the `applm` package will probably break it.\n\nIf you like what we are doing, want to watch our progress, or want to contribute, please feel free to engage with the repo on github.\n\nWe are looking for contributors to help further develop this package.\n\nThe refactor is not complete, but we will make regular updates as we progress.\n\nIf you are the Apple developer in charge of leading the mlx-lm package development, and you also have the goal to refactor the mlx-lm package to be less opinionated and more developer customizable, feel free to use this package as inspiration, fork it, merge it, or collaborate either on this package or the mlx-lm package.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Language Model Tools for Apple Silicon",
    "version": "0.0.51",
    "project_urls": {
        "Homepage": "https://github.com/Jonathan-Dobson/applm",
        "Issues": "https://github.com/Jonathan-Dobson/applm/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b511970862b26c46e3574077ca4e7307095a1a9111d456feed5e30c5cdbeac7b",
                "md5": "2d5cdb351ebc0a8cfd1d670a6ac6777e",
                "sha256": "a71e7a5c9786b87afde6f5524e3c03253281bc3eca8871d965146eaa9cb0fb3d"
            },
            "downloads": -1,
            "filename": "applm-0.0.51-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2d5cdb351ebc0a8cfd1d670a6ac6777e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 80671,
            "upload_time": "2024-08-14T03:55:53",
            "upload_time_iso_8601": "2024-08-14T03:55:53.199860Z",
            "url": "https://files.pythonhosted.org/packages/b5/11/970862b26c46e3574077ca4e7307095a1a9111d456feed5e30c5cdbeac7b/applm-0.0.51-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "79faa62bddfc50fda63f2c4a75dd151cb6829133be08e8efc20ce2120462846e",
                "md5": "8f9cde1da833494903f5376a93b6788f",
                "sha256": "225f339ff25104c84d2951d72e1510c9b8a28cba6fc3a5111af69776aeca2ae8"
            },
            "downloads": -1,
            "filename": "applm-0.0.51.tar.gz",
            "has_sig": false,
            "md5_digest": "8f9cde1da833494903f5376a93b6788f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 46075,
            "upload_time": "2024-08-14T03:55:54",
            "upload_time_iso_8601": "2024-08-14T03:55:54.697630Z",
            "url": "https://files.pythonhosted.org/packages/79/fa/a62bddfc50fda63f2c4a75dd151cb6829133be08e8efc20ce2120462846e/applm-0.0.51.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-14 03:55:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Jonathan-Dobson",
    "github_project": "applm",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "applm"
}
        
Elapsed time: 0.51254s