Run this model with HF Jobs

Run codellama/CodeLlama-70b-Python-hf 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 and TRL to fine-tune https://huggingface.co/codellama/CodeLlama-70b-Python-hf. 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/codellama/CodeLlama-70b-Python-hf 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/codellama/CodeLlama-70b-Python-hf. 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/codellama/CodeLlama-70b-Python-hf. 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.

Example code

#2
by HFMSalazar - opened

Could we have a working example using this model? Always nice to have a place to start that is not a rabbit hole.

Here is an example... but I would refer to a much smaller model 7B or 13B. You need atleast 48 gb gpu for this one, and that if you quantize it.

from transformers import pipeline
import torch

# Check if CUDA (GPU support) is available and use it; otherwise, use CPU
device = "cuda" if torch.cuda.is_available() else "cpu"

# Load the pipeline with your specified model
pipe = pipeline("text-generation", model="codellama/CodeLlama-70b-Python-hf", device=device)

# Enable 16-bit precision (fp16)
if device == "cuda":
    pipe.model.half()

# Example usage of the pipeline
text = pipe("Example input text", max_length=50)[0]['generated_text']
print(text)
Code Llama org

Feel free to open a PR to add this to the readme for example!

Sign up or log in to comment