Skip to main content

Language Model Tools for Apple Silicon

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

applm-0.0.51.tar.gz (46.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

applm-0.0.51-py3-none-any.whl (80.7 kB view details)

Uploaded Python 3

File details

Details for the file applm-0.0.51.tar.gz.

File metadata

  • Download URL: applm-0.0.51.tar.gz
  • Upload date:
  • Size: 46.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for applm-0.0.51.tar.gz
Algorithm Hash digest
SHA256 225f339ff25104c84d2951d72e1510c9b8a28cba6fc3a5111af69776aeca2ae8
MD5 8f9cde1da833494903f5376a93b6788f
BLAKE2b-256 79faa62bddfc50fda63f2c4a75dd151cb6829133be08e8efc20ce2120462846e

See more details on using hashes here.

File details

Details for the file applm-0.0.51-py3-none-any.whl.

File metadata

  • Download URL: applm-0.0.51-py3-none-any.whl
  • Upload date:
  • Size: 80.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for applm-0.0.51-py3-none-any.whl
Algorithm Hash digest
SHA256 a71e7a5c9786b87afde6f5524e3c03253281bc3eca8871d965146eaa9cb0fb3d
MD5 2d5cdb351ebc0a8cfd1d670a6ac6777e
BLAKE2b-256 b511970862b26c46e3574077ca4e7307095a1a9111d456feed5e30c5cdbeac7b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page