Run this model with HF Jobs

Run bigcode/starcoder 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/bigcode/starcoder. Ask me which dataset to train on, then push the fine-tuned model to a new private 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/bigcode/starcoder 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/bigcode/starcoder. Ask me which benchmark to run, then save the scores and the per-example results to a new private 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/bigcode/starcoder. Push it to a new private model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

Inconsistent Results Between HF Inference API and StarCoder Playground for Code Completion Task

#105
by FWeindel - opened

Hello,

I am currently facing an issue with the Hugging Face (HF) Inference API when trying to perform code completion tasks using the StarCoder model. Although I follow the provided examples and match my API call parameters to those in the StarCoder Playground, my requests often return an empty string, or, if I adjust the temperature parameter closer to zero, the output becomes nonsensical and impractical. This happens with prompts that return valid and meaningful completions on the StarCoder Playground and web inference API next to the model card. I also observe inconsistencies between the StarCoder Playground and the web inference API next to the model card.

Technical Details:
Here's how I structure my API calls:

def query(self, payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()

def _draw_sample(self, prompt: str, temperature=0.2, max_new_tokens=256, top_p=0.9, repetition_penalty=1.2) -> str:
# Define the payload with the modified prompt and additional parameters
payload = {
"inputs": prompt,
"parameters": {
"temperature": temperature,
"max_new_tokens": max_new_tokens,
"top_p": top_p,
"repetition_penalty": repetition_penalty,
"return_full_text": False,
"do_sample": True,
},
"options": {"use_cache": True}
}
response = self.query(payload)
logging.info(f"response from LLM is {response}")
# Extract the generated code from the response
return response

Prompt Details:
The prompt includes a docstring that describes the script's functionality and a brief explanation of the code completion task (e.g., 'Improve priority_v1 over priority_v0 from the previous iteration'), context functions, the function from the previous iteration, and finally, the function header and docstring for which StarCoder is expected to generate the body.

Any help understanding the reason for the discrepancy between the API and Playground results or alternative approaches to structuring my prompt and API requests would be greatly appreciated.

Thank you!

Attached below are screenshots showcasing the outputs on the Playground and the web inference tool next to the model card for comparison.Screenshot 2024-02-23 at 11.59.48.png

Screenshot 2024-02-23 at 12.00.49.png

Sign up or log in to comment