Run this model with HF Jobs

Run bigcode/starcoder2-15b 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/starcoder2-15b. 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/bigcode/starcoder2-15b 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/starcoder2-15b. 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/bigcode/starcoder2-15b. 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.

Error loading Starcoder model

#31
by Polaris715 - opened

I encountered the following error when loading the locally downloaded starcoder2.

Traceback (most recent call last): File "/home/star/sgz/GraphCoder-main/patch_predictor.py", line 428, in main(args) ^^^^^^^^^^ File "/home/star/sgz/GraphCoder-main/patch_predictor.py", line 380, in main predictor = PatchCorrectnessPredictor( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/star/sgz/GraphCoder-main/patch_predictor.py", line 66, in init raise ValueError(f"Error loading Starcoder model: {str(e)}") ValueError: Error loading Starcoder model: The checkpoint you are trying to load has model type starcoder2 but Transformers does not recognize this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers is out of date

My code

    elif model.startswith('Starcoder2-'):
        # # Starcoder2 family (e.g. starcoder2-7b, starcoder2-15b)
        model_path = os.path.join(models_cache_dir, model)
        tokenizer_path = os.path.join(models_cache_dir, f"{model}-tokenizer")

        try:
            self.model = AutoModelForCausalLM.from_pretrained(
                model_path,
                torch_dtype=torch.float16,
                device_map = "auto",
                # low_cpu_mem_usage=True,
            ).to(self.device)
            tokenizer_raw = AutoTokenizer.from_pretrained(tokenizer_path, trust_remote_code=True)
            if getattr(tokenizer_raw, "pad_token", None) is None and getattr(tokenizer_raw, "eos_token",
                                                                             None) is not None:
                tokenizer_raw.pad_token = tokenizer_raw.eos_token

            from utils.utils import StarCoderTokenizer
            self.tokenizer = StarCoderTokenizer(tokenizer_raw)
            self.raw_tokenizer = tokenizer_raw
            self.max_context_tokens = (16000 - 16)
            self.model_type = "huggingface"
            self.generation_config = GenerationConfig(
                max_new_tokens=16,
                do_sample=False,
                #temperature=0,
                eos_token_id=tokenizer_raw.eos_token_id,
                pad_token_id=tokenizer_raw.pad_token_id,
            )
        except Exception as e:
            raise ValueError(f"Error loading Starcoder model: {str(e)}")

Attempting to upgrade the Transformer to the latest version has failed to resolve the issue.

Sign up or log in to comment