mlx-lm 0.0.0.dev8__tar.gz → 0.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mlx-lm
3
- Version: 0.0.0.dev8
3
+ Version: 0.0.2
4
4
  Summary: LLMs on Apple silicon with MLX and the Hugging Face Hub
5
5
  Home-page: https://github.com/ml-explore/mlx-examples
6
6
  Author: MLX Contributors
@@ -149,11 +149,16 @@ def upload_to_hub(path: str, upload_repo: str, hf_path: str):
149
149
  This model was converted to MLX format from [`{hf_path}`]().
150
150
  Refer to the [original model card](https://huggingface.co/{hf_path}) for more details on the model.
151
151
  ## Use with mlx
152
+
152
153
  ```bash
153
- pip install mlx
154
- git clone https://github.com/ml-explore/mlx-examples.git
155
- cd mlx-examples/llms/hf_llm
156
- python generate.py --model {upload_repo} --prompt "My name is"
154
+ pip install mlx-lm
155
+ ```
156
+
157
+ ```python
158
+ from mlx_lm import load, generate
159
+
160
+ model, tokenizer = load("{upload_repo}")
161
+ response = generate(model, tokenizer, prompt="hello", verbose=True)
157
162
  ```
158
163
  """
159
164
  card.save(os.path.join(path, "README.md"))
@@ -1,5 +1,6 @@
1
1
  import math
2
2
  from dataclasses import dataclass
3
+ from typing import Tuple
3
4
 
4
5
  import mlx.core as mx
5
6
  import mlx.nn as nn
@@ -128,7 +129,7 @@ class Model(nn.Module):
128
129
  x: mx.array,
129
130
  mask: mx.array = None,
130
131
  cache: mx.array = None,
131
- ) -> tuple[mx.array, mx.array]:
132
+ ) -> Tuple[mx.array, mx.array]:
132
133
  mask = None
133
134
  if x.shape[1] > 1:
134
135
  mask = nn.MultiHeadAttention.create_additive_causal_mask(x.shape[1])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mlx-lm
3
- Version: 0.0.0.dev8
3
+ Version: 0.0.2
4
4
  Summary: LLMs on Apple silicon with MLX and the Hugging Face Hub
5
5
  Home-page: https://github.com/ml-explore/mlx-examples
6
6
  Author: MLX Contributors
@@ -8,7 +8,7 @@ with open(Path(__file__).parent / "mlx_lm/requirements.txt") as fid:
8
8
  requirements = [str(r) for r in pkg_resources.parse_requirements(fid)]
9
9
  setup(
10
10
  name="mlx-lm",
11
- version="0.0.0.dev8",
11
+ version="0.0.2",
12
12
  description="LLMs on Apple silicon with MLX and the Hugging Face Hub",
13
13
  long_description=open("README.md", encoding="utf-8").read(),
14
14
  long_description_content_type="text/markdown",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes