Skip to main content

AppLM

AppLM brings Language Model Tools to Apple Silicon.

This project aiming to refactor the 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

pip install transformers mlx applm

Generate

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

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.

Metadata

Release files for applm 0.0.51

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for applm 0.0.51
File Size Uploaded Provenance
applm-0.0.51.tar.gz 46.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for applm 0.0.51
File Interpreter ABI Platform
applm-0.0.51-py3-none-any.whl Python 3 none any Details

Total release size: 126.7 kB

Release files / applm-0.0.51.tar.gz

Download URL applm-0.0.51.tar.gz
Size 46.1 kB
Tags Source
SHA-256 checksum
How to use checksums
225f339ff25104c84d2951d72e1510c9b8a28cba6fc3a5111af69776aeca2ae8
BLAKE2b-256 checksum
How to use checksums
79faa62bddfc50fda63f2c4a75dd151cb6829133be08e8efc20ce2120462846e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.14

Release files / applm-0.0.51-py3-none-any.whl

Download URL applm-0.0.51-py3-none-any.whl
Size 80.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a71e7a5c9786b87afde6f5524e3c03253281bc3eca8871d965146eaa9cb0fb3d
BLAKE2b-256 checksum
How to use checksums
b511970862b26c46e3574077ca4e7307095a1a9111d456feed5e30c5cdbeac7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.14

Security for applm 0.0.51

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page