Views
No views yet
Note: This repo contains LoRA weights only. You will need the base model from Meta under the Llama 3.2 community license. See the license section below.
1# Inference with the adapter
2mlx_lm generate --model mlx-community/Llama-3.2-1B-Instruct-4bit --adapter-path /path/to/adapter-folder --temp 0.2 --max-tokens 120 --prompt 'You are a strict rater of charity purpose statements. Use only the 1 to 5 scale.
3
4Rate the charity purpose statement on five 1 to 5 scales. Return only a compact JSON object with these integer keys: Specificity, Clarity, Impact, Inclusivity, "Attainable Goals". Do not include explanations.
5
6Charity: Example Org
7Statement: "We help young people into good jobs through mentoring and accredited training."'```1from mlx_lm import load, generate
2
3MODEL = "mlx-community/Llama-3.2-1B-Instruct-4bit"
4ADAPTER = "/path/to/adapter-folder" # folder that contains adapters.safetensors
5
6system = "You are a strict rater of charity purpose statements. Use only the 1 to 5 scale."
7user = (
8 'Rate the charity purpose statement on five 1 to 5 scales. '
9 'Return only a compact JSON object with these integer keys: '
10 'Specificity, Clarity, Impact, Inclusivity, "Attainable Goals". '
11 'Do not include explanations.\n\n'
12 'Charity: Example Org\n'
13 'Statement: "We help young people into good jobs through mentoring and accredited training."'
14)
15prompt = f"{system}\n\n{user}"
16
17model, tokenizer = load(MODEL, adapter_path=ADAPTER)
18out = generate(model, tokenizer, prompt, max_tokens=120, temp=0.2)
19print(out)You are a strict rater of charity purpose statements. Use only the 1 to 5 scale.Rate the charity purpose statement on five 1 to 5 scales. Return only a compact JSON object with these integer keys: Specificity, Clarity, Impact, Inclusivity, "Attainable Goals". Do not include explanations.
Charity: {name}
Statement: "{text}"{"Specificity": <int>, "Clarity": <int>, "Impact": <int>, "Inclusivity": <int>, "Attainable Goals": <int>}messages entries--mask-prompt so loss applies to assistant tokens onlyvalid.jsonl and generating with temperature 0.2, then parsing the JSON.