Views
No views yet
llama.cpp compatible).<|im_start|>system...)llama-cpp-python)NanoMend-1.5-Ultimate locally using Python in just a few lines:pip install llama-cpp-python huggingface_hub1from huggingface_hub import hf_hub_download
2from llama_cpp import Llama
3
4# 1. Download model from Hugging Face Hub
5model_path = hf_hub_download(
6 repo_id="xenonshare/NanoMend-1.5-Ultimate",
7 filename="nanomend-ultimate-1.5b.gguf"
8)
9
10# 2. Load model into CPU memory
11llm = Llama(
12 model_path=model_path,
13 n_ctx=2048,
14 n_threads=8,
15 verbose=False
16)
17
18# 3. Format Prompt (ChatML Format)
19system_prompt = "You are a Senior Python Developer. The user's code has a CRITICAL error: INTENT ERROR. Function 'add' implies addition but uses multiplication (*). Rewrite the code to fix this. Output ONLY the fixed python code."
20code_snippet = """def add(a, b):
21 return a * b
22"""
23
24prompt = f"<|im_start|>system\n{system_prompt}<|im_end|>\n<|im_start|>user\n{code_snippet}<|im_end|>\n<|im_start|>assistant\n"
25
26# 4. Generate Repair
27output = llm(
28 prompt,
29 max_tokens=256,
30 stop=["<|im_end|>"],
31 temperature=0.1
32)
33
34print(output['choices'][0]['text'])1<|im_start|>system
2You are a Senior Python Developer. The user's code has a CRITICAL error: {AST_WARNING}. Rewrite the code to fix this. Output ONLY the fixed python code.<|im_end|>
3<|im_start|>user
4{PYTHON_CODE}<|im_end|>
5<|im_start|>assistantModelfile:1FROM ./nanomend-ultimate-1.5b.gguf
2
3TEMPLATE """<|im_start|>system
4{{ .System }}<|im_end|>
5<|im_start|>user
6{{ .Prompt }}<|im_end|>
7<|im_start|>assistant
8"""
9
10PARAMETER stop "<|im_end|>"
11PARAMETER temperature 0.11ollama create nanomend -f Modelfile
2ollama run nanomend "Fix this loop: while x > 0: print(x)"NanoMend-1.5-Ultimate is fine-tuned to resolve the 12 primary Python logic traps:open() without with or .close())multiply using +, is_even returning odd)return None)