MLX
Safetensors

Run this model with HF Jobs

Run Xylolabs/openpilot-driving-MLX on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/Xylolabs/openpilot-driving-MLX. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/Xylolabs/openpilot-driving-MLX on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
File size: 1,170 Bytes
106420c
 
 
 
 
 
 
 
 
 
 
 
 
e9113c0
 
 
 
106420c
 
 
 
 
 
 
e9113c0
 
106420c
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Run the packaged model on synthetic inputs and reuse its next state."""

import mlx.core as mx

from model import Model


def main():
    mx.set_default_device(mx.cpu)
    model = Model()
    states = model.initial_state()
    inputs = {name: mx.zeros(shape, dtype) for name, (shape, dtype) in model.inputs.items()
              if name not in states}
    if "traffic_convention" in inputs:
        shape, dtype = model.inputs["traffic_convention"]
        inputs["traffic_convention"] = mx.array([1, 0], dtype=dtype).reshape(shape)
    if "action_t" in inputs:
        inputs["action_t"] = mx.array([[0.2, 0.3]], dtype=mx.float32)
    for _ in range(2 if states else 1):
        outputs = model(**inputs, **states)
        mx.eval(*outputs.values())
        states = {name: outputs[f"next_{name}"] for name in states}
    print({name: (value.shape, str(value.dtype)) for name, value in outputs.items()})
    for head in model.graph["output_slices"]:
        tensor = head.get("tensor", "outputs")
        values = outputs[tensor][..., head["start"]:head["stop"]]
        print(head["name"], values.shape, values[0, 0].item())


if __name__ == "__main__":
    main()