Run this model with HF Jobs

Run Maaac/CodeLLaMA-Linux-BugFix 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/Maaac/CodeLLaMA-Linux-BugFix. 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/Maaac/CodeLLaMA-Linux-BugFix 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.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/Maaac/CodeLLaMA-Linux-BugFix. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/Maaac/CodeLLaMA-Linux-BugFix. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
CodeLLaMA-Linux-BugFix / evaluate /compute_metrics.py
Mac
Push evaluation results and update readme
5de6ff4
Raw History Blame Contribute Delete
1.07 kB
# compute_metrics.py
import json
from pathlib import Path
import sacrebleu
from rouge_score import rouge_scorer, scoring
# === Config ===
RESULTS_FILE = "./output/eval_results.json"
assert Path(RESULTS_FILE).exists(), f"File not found: {RESULTS_FILE}"
# === Load data ===
with open(RESULTS_FILE, "r", encoding="utf-8") as f:
data = json.load(f)
references = [entry["reference"] for entry in data]
predictions = [entry["prediction"] for entry in data]
# === Compute BLEU ===
bleu = sacrebleu.corpus_bleu(predictions, [references])
print("✅ BLEU Score:", bleu.score)
# === Compute ROUGE ===
scorer = rouge_scorer.RougeScorer(["rouge1", "rouge2", "rougeL"], use_stemmer=True)
aggregator = scoring.BootstrapAggregator()
for pred, ref in zip(predictions, references):
scores = scorer.score(ref, pred)
aggregator.add_scores(scores)
rouge_result = aggregator.aggregate()
print("\n✅ ROUGE Scores:")
for k, v in rouge_result.items():
print(f"{k}: P={v.mid.precision:.4f}, R={v.mid.recall:.4f}, F1={v.mid.fmeasure:.4f}")