Run this model with HF Jobs

Run ashwinR/CodeExplainer 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/ashwinR/CodeExplainer. 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/ashwinR/CodeExplainer 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.

Model Trained Using AutoTrain

  • Problem type: Summarization
  • Model ID: 2745581349
  • CO2 Emissions (in grams): 5.3931

Model Description

This model is an attempt to simplify code understanding by generating line by line explanation of a source code. This model was fine-tuned using the Salesforce/codet5-large model. Currently it is trained on a small subset of Python snippets.

Model Usage

from transformers import (
    AutoModelForSeq2SeqLM,
    AutoTokenizer,
    AutoConfig,
    pipeline,
)

model_name = "ashwinR/CodeExplainer"

tokenizer = AutoTokenizer.from_pretrained(model_name, padding=True)

model = AutoModelForSeq2SeqLM.from_pretrained(model_name)

config = AutoConfig.from_pretrained(model_name)

model.eval()

pipe = pipeline("summarization", model=model_name, config=config, tokenizer=tokenizer)

raw_code = """
def preprocess(text: str) -> str:
    text = str(text)
    text = text.replace("\n", " ")
    tokenized_text = text.split(" ")
    preprocessed_text = " ".join([token for token in tokenized_text if token])

    return preprocessed_text
"""

print(pipe(raw_code)[0]["summary_text"])

Validation Metrics

  • Loss: 2.156
  • Rouge1: 29.375
  • Rouge2: 18.128
  • RougeL: 25.445
  • RougeLsum: 28.084
  • Gen Len: 19.000
Downloads last month
32
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Dataset used to train ashwinR/CodeExplainer

Space using ashwinR/CodeExplainer 1