https://github.com/amazon-science/cceval

CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completion (NeurIPS 2023)

https://github.com/amazon-science/cceval

Science Score: 33.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
    1 of 5 committers (20.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.5%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completion (NeurIPS 2023)

Basic Info
Statistics
  • Stars: 150
  • Watchers: 7
  • Forks: 23
  • Open Issues: 4
  • Releases: 0
Created over 2 years ago · Last pushed almost 2 years ago
Metadata Files
Readme Contributing License Code of conduct

README.md

CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completion

This repository contains the data and inference code of the NeurIPS 2023 (Datasets and Benchmarks track) paper "CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completion."

Requirements

  • Uncompress the CrossCodeEval data via tar -xvJf data/crosscodeeval_data.tar.xz -C data/
    • The data contains {baseline, retrieval, retrieval w/ ref.} setting x {bm25, UniXCoder, OpenAI Ada} retriever.
    • Please email us if you need the raw data.
  • Install dependencies via pip install -r requirements.txt
  • Build tree sitter via bash scripts/build_treesitter.sh

Evaluation on CrossCodeEval

Our evaluation consists of two steps: generation and metrics calculation.

Generation

Publicly Available Models

For publicly available models like StarCoder, DeepSeek-Coder, etc., we recommended using vLLM for fast and distributed inference on CrossCodeEval.

bash export gpus=2 export model=bigcode/starcoder2-3b export language=python export task=line_completion_rg1_unixcoder_cosine_sim export output_dir=./tmp/crosscodeeval_testrun/ python scripts/vllm_inference.py \ --tp $gpus \ --task $task \ --language $language \ --model $model \ --output_dir $output_dir \ --use_crossfile_context For additional args, e.g., cross-file context length and sampling topp, please see `python vllminference.py --help`.

If you prefer non-vLLM script :: click to expand ::
First, configure `accelerate` via `accelerate config` if you haven't. A reference configuration is available at `cceval_config.yaml` The following command demonstrates how to run greedy eval using codegen-350M on python with cross-file context. ```bash export model_type=codelm_cfc # or codelm for no cross-file context eval export model_name=Salesforce/codegen-350M-mono export language=python export ts_lib=./build/${language}-lang-parser.so export dtype=bf16 # or fp16 export prompt_file=./data/crosscodeeval_data/${language}/line_completion_rg1_unixcoder_cosine_sim.jsonl # or other options in the dir, which corresponds to different retrieval methods and/or retrieval settings export max_seq_length=2048 export cfc_seq_length=512 export batch_size=16 # reduce for larger models export output_dir=./tmp/crosscodeeval_testrun/ accelerate launch eval.py \ --model_type $model_type \ --model_name_or_path $model_name \ --cfc_seq_length $cfc_seq_length \ --prompt_file $prompt_file \ --gen_length 50 \ --max_seq_length $max_seq_length \ --batch_size $batch_size \ --output_dir $output_dir \ --dtype $dtype \ --num_return_sequences 1 \ --overwrite_cache True \ --ts_lib $ts_lib \ --language $language ``` You may run sampling via the following (additional) args: ```bash --do_sample \ --top_p 0.95 \ --temperature 0.2 \ --num_return_sequences 5 \ ```

OpenAI models

OpenAI models are accessible through an API. You may use the following script: ```bash export model=gpt-3.5-turbo-0125 export language=python export task=linecompletionrg1unixcodercosinesim export outputdir=./tmp/crosscodeevalopenaitestrun/ python scripts/openaiinference.py \ --task $task \ --language $language \ --model $model \ --outputdir $outputdir \ --usecrossfile_context

```

Metrics Calculation

After obtaining the generation, we can calculate the final metrics bash export language=python export ts_lib=./build/${language}-lang-parser.so; export task=line_completion_oracle_unixcoder_cosine_sim export prompt_file=./data/${language}/${task}.jsonl export output_dir=./tmp/crosscodeeval_testrun/; python scripts/eval.py \ --prompt_file $prompt_file \ --output_dir $output_dir \ --ts_lib $ts_lib \ --language $language \ --only_compute_metric

Citation

```

@inproceedings{ding2023crosscodeeval, title={CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completion}, author={Yangruibo Ding and Zijian Wang and Wasi Uddin Ahmad and Hantian Ding and Ming Tan and Nihal Jain and Murali Krishna Ramanathan and Ramesh Nallapati and Parminder Bhatia and Dan Roth and Bing Xiang}, year={2023}, booktitle={Thirty-seventh Conference on Neural Information Processing Systems Datasets and Benchmarks Track}, url={https://arxiv.org/pdf/2310.11248.pdf} } ```

Questions

Please feel free to email us. You may also submit an issue in this repo.

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

Owner

  • Name: Amazon Science
  • Login: amazon-science
  • Kind: organization

GitHub Events

Total
  • Issues event: 4
  • Watch event: 34
  • Pull request event: 2
  • Fork event: 8
Last Year
  • Issues event: 4
  • Watch event: 34
  • Pull request event: 2
  • Fork event: 8

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 23
  • Total Committers: 5
  • Avg Commits per committer: 4.6
  • Development Distribution Score (DDS): 0.565
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Zijian Wang z****n@a****m 10
Zijian Wang z****g@s****u 6
Nihal Jain n****n@g****m 3
wuahmad w****d@a****m 3
Amazon GitHub Automation 5****o 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 18
  • Total pull requests: 7
  • Average time to close issues: 9 days
  • Average time to close pull requests: about 1 month
  • Total issue authors: 14
  • Total pull request authors: 4
  • Average comments per issue: 2.44
  • Average comments per pull request: 0.57
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 5
  • Pull requests: 1
  • Average time to close issues: 1 day
  • Average time to close pull requests: 1 minute
  • Issue authors: 5
  • Pull request authors: 1
  • Average comments per issue: 0.8
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • 18liumin (2)
  • ganler (2)
  • starlitsky2010 (2)
  • madhavatreplit (1)
  • anmolagarwal999 (1)
  • czq99972 (1)
  • AaboutL (1)
  • ramsey-coding (1)
  • kartikzheng (1)
  • leiwen83 (1)
  • bsobolev (1)
  • njuweicheng (1)
  • VulDetect-llm (1)
  • zheng5yu9 (1)
  • wapleeeeee (1)
Pull Request Authors
  • nihaljn (3)
  • zijwang (3)
  • dependabot[bot] (2)
  • wasiahmad (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (2)