Updated README
Browse files
README.md
CHANGED
|
@@ -2,4 +2,69 @@
|
|
| 2 |
license: mit
|
| 3 |
base_model:
|
| 4 |
- jinaai/ReaderLM-v2
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: mit
|
| 3 |
base_model:
|
| 4 |
- jinaai/ReaderLM-v2
|
| 5 |
+
tags:
|
| 6 |
+
- mlx
|
| 7 |
+
---
|
| 8 |
+
# mlx-community/jinaai-ReaderLM-v2
|
| 9 |
+
|
| 10 |
+
The Model [mlx-community/jinaai-ReaderLM-v2](https://huggingface.co/mlx-community/jinaai-ReaderLM-v2) was
|
| 11 |
+
converted to MLX format from [jinaai/ReaderLM-v2](https://huggingface.co/jinaai/ReaderLM-v2).
|
| 12 |
+
---
|
| 13 |
+
## Use with mlx
|
| 14 |
+
|
| 15 |
+
```bash
|
| 16 |
+
pip install mlx-lm
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
```python
|
| 20 |
+
from mlx_lm import load, generate
|
| 21 |
+
|
| 22 |
+
model, tokenizer = load("mlx-community/jinaai-ReaderLM-v2")
|
| 23 |
+
|
| 24 |
+
prompt="hello"
|
| 25 |
+
|
| 26 |
+
if hasattr(tokenizer, "apply_chat_template") and tokenizer.chat_template is not None:
|
| 27 |
+
messages = [{"role": "user", "content": prompt}]
|
| 28 |
+
prompt = tokenizer.apply_chat_template(
|
| 29 |
+
messages, tokenize=False, add_generation_prompt=True
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
response = generate(model, tokenizer, prompt=prompt, verbose=True)
|
| 33 |
+
```
|
| 34 |
+
---
|
| 35 |
+
## Use with mlx model manager
|
| 36 |
+
```bash
|
| 37 |
+
Add Package Dependency in xcode: https://github.com/kunal732/MLX-Model-Manager
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
```swift
|
| 41 |
+
import SwiftUI
|
| 42 |
+
import MLXModelManager
|
| 43 |
+
|
| 44 |
+
struct ContentView: View {
|
| 45 |
+
|
| 46 |
+
@StateObject var JinaManager = ModelManager(modelPath: "mlx-community/jinaai-ReaderLM-v2")
|
| 47 |
+
|
| 48 |
+
var body: some View {
|
| 49 |
+
VStack {
|
| 50 |
+
|
| 51 |
+
Button("answer prompt"){
|
| 52 |
+
Task {
|
| 53 |
+
//load model
|
| 54 |
+
try await JinaManager.loadModel()
|
| 55 |
+
|
| 56 |
+
//inference
|
| 57 |
+
await JinaManager.generate(
|
| 58 |
+
prompt: "convert to markdown: <!DOCTYPE html><html><body><h1>Html Heading One</h1><p>first paragraph.</p></body></html>"
|
| 59 |
+
)
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
//Model Output
|
| 65 |
+
Text(JinaManager.output)
|
| 66 |
+
}
|
| 67 |
+
.padding()
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
```
|