{"id":15033175,"url":"https://github.com/salesforce/codegen","last_synced_at":"2025-05-13T19:07:17.596Z","repository":{"id":37540190,"uuid":"475174123","full_name":"salesforce/CodeGen","owner":"salesforce","description":"CodeGen is a family of open-source model for program synthesis. Trained on TPU-v4. Competitive with OpenAI Codex.","archived":false,"fork":false,"pushed_at":"2025-01-31T21:43:30.000Z","size":1421,"stargazers_count":5070,"open_issues_count":45,"forks_count":398,"subscribers_count":80,"default_branch":"main","last_synced_at":"2025-04-27T04:45:37.498Z","etag":null,"topics":["codex","generativemodel","languagemodel","llm","programsynthesis","tpu-acceleration"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/salesforce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-28T20:48:29.000Z","updated_at":"2025-04-26T06:14:18.000Z","dependencies_parsed_at":"2022-08-08T20:31:02.825Z","dependency_job_id":"d22722ac-6caf-49c1-8d98-2202c2e24a4b","html_url":"https://github.com/salesforce/CodeGen","commit_stats":{"total_commits":76,"total_committers":10,"mean_commits":7.6,"dds":0.368421052631579,"last_synced_commit":"f210c3bb1216c975ad858cd4132c0fdeabf4bfc2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforce%2FCodeGen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforce%2FCodeGen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforce%2FCodeGen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforce%2FCodeGen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/salesforce","download_url":"https://codeload.github.com/salesforce/CodeGen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251089408,"owners_count":21534512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codex","generativemodel","languagemodel","llm","programsynthesis","tpu-acceleration"],"created_at":"2024-09-24T20:20:18.963Z","updated_at":"2025-04-27T04:45:47.145Z","avatar_url":"https://github.com/salesforce.png","language":"Python","funding_links":[],"categories":["NLP"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/codegen_logo.png\" width=\"25%\"\u003e\n\u003c/p\u003e\n\n# CodeGen\nOfficial release for the **CodeGen1** and **CodeGen2** models (`350M`, `1B`, `3B`, `7B` `16B`) for **Program Synthesis** by [Salesforce AI Research](https://www.salesforceairesearch.com/).\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/two.gif\" width=\"60%\"\u003e\n\u003c/p\u003e\n\n## News\n\n**July 2023**\n\n[**CodeGen2.5**](https://github.com/salesforce/CodeGen/tree/main/codegen25) released outperforming 16B parameter models with only 7B.\n\n**May 2023**\n\n**CodeGen2.0** released with strong infill sampling capability.\n\n**March 2022**\n\n**CodeGen1.0** released on par with OpenAI Codex at the time.\n\n## Publications\n\n[CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis](https://arxiv.org/abs/2203.13474)  \n[Erik Nijkamp](https://enijkamp.github.io/)\\*, [Bo Pang](https://scholar.google.com/citations?user=s9fNEVEAAAAJ\u0026hl=en)\\*, [Hiroaki Hayashi](https://hiroakih.me/)\\*, [Lifu Tu](https://home.ttic.edu/~lifu/), [Huan Wang](https://scholar.google.com/citations?user=7NpTttkAAAAJ\u0026hl=en), [Yingbo Zhou](https://scholar.google.com/citations?user=H_6RQ7oAAAAJ\u0026hl=en), [Silvio Savarese](https://scholar.google.com/citations?user=ImpbxLsAAAAJ\u0026hl=en), and [Caiming Xiong](https://scholar.google.com/citations?user=vaSdahkAAAAJ\u0026hl=en)   \nICLR, 2023\n\n[CodeGen2: Lessons for Training LLMs on Programming and Natural Languages](https://arxiv.org/abs/2305.02309)   \n[Erik Nijkamp](https://enijkamp.github.io/)\\*, [Hiroaki Hayashi](https://hiroakih.me/)\\*, [Caiming Xiong](https://scholar.google.com/citations?user=vaSdahkAAAAJ\u0026hl=en), [Silvio Savarese](https://scholar.google.com/citations?user=ImpbxLsAAAAJ\u0026hl=en), and [Yingbo Zhou](https://scholar.google.com/citations?user=H_6RQ7oAAAAJ\u0026hl=en)  \nICLR, 2023\n\n## Usage\n\nThe models are available on the [Hugging Face Hub](https://huggingface.co/models?search=salesforce+codegen).\n\n**CodeGen1.0**\n\n```python\nimport torch\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\n\ntokenizer = AutoTokenizer.from_pretrained(\"Salesforce/codegen-2B-mono\")\nmodel = AutoModelForCausalLM.from_pretrained(\"Salesforce/codegen-2B-mono\")\ninputs = tokenizer(\"# this function prints hello world\", return_tensors=\"pt\")\nsample = model.generate(**inputs, max_length=128)\nprint(tokenizer.decode(sample[0], truncate_before_pattern=[r\"\\n\\n^#\", \"^'''\", \"\\n\\n\\n\"]))\n```\n\n**CodeGen2.0**\n\n```python\nimport torch\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\n\ntokenizer = AutoTokenizer.from_pretrained(\"Salesforce/codegen2-7B\")\nmodel = AutoModelForCausalLM.from_pretrained(\"Salesforce/codegen2-7B\", trust_remote_code=True, revision=\"main\")\ninputs = tokenizer(\"# this function prints hello world\", return_tensors=\"pt\")\nsample = model.generate(**inputs, max_length=128)\nprint(tokenizer.decode(sample[0], truncate_before_pattern=[r\"\\n\\n^#\", \"^'''\", \"\\n\\n\\n\"]))\n```\n\n**CodeGen2.5**\n\n```python\nimport torch\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\n\ntokenizer = AutoTokenizer.from_pretrained(\"Salesforce/codegen25-7b-mono\", trust_remote_code=True)\nmodel = AutoModelForCausalLM.from_pretrained(\"Salesforce/codegen25-7b-mono\")\ninputs = tokenizer(\"# this function prints hello world\", return_tensors=\"pt\")\nsample = model.generate(**inputs, max_length=128)\nprint(tokenizer.decode(sample[0]))\n```\n\n## Training\n\nThe Jaxformer library for data pre-processing, training and fine-tuning the CodeGen models can be found here:\n\nhttps://github.com/salesforce/jaxformer\n\n## Citation\nIf you find our code or paper useful, please cite the paper:\n```bibtex\n@article{nijkamp2022codegen,\n  title={CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis},\n  author={Nijkamp, Erik and Pang, Bo and Hayashi, Hiroaki and Tu, Lifu and Wang, Huan and Zhou, Yingbo and Savarese, Silvio and Xiong, Caiming},\n  journal={ICLR},\n  year={2023}\n}\n\n@article{nijkamp2023codegen2,\n  title={CodeGen2: Lessons for Training LLMs on Programming and Natural Languages},\n  author={Nijkamp, Erik and Hayashi, Hiroaki and Xiong, Caiming and Savarese, Silvio and Zhou, Yingbo},\n  journal={ICLR},\n  year={2023}\n}\n```\n\n## Ethics disclaimer for Salesforce AI models, data, code\n\nThis release is for research purposes only in support of an academic\npaper. Our models, datasets, and code are not specifically designed or\nevaluated for all downstream purposes. We strongly recommend users\nevaluate and address potential concerns related to accuracy, safety, and\nfairness before deploying this model. We encourage users to consider the\ncommon limitations of AI, comply with applicable laws, and leverage best\npractices when selecting use cases, particularly for high-risk scenarios\nwhere errors or misuse could significantly impact people’s lives, rights,\nor safety. For further guidance on use cases, refer to our standard\n[AUP](https://www.salesforce.com/content/dam/web/en_us/www/documents/legal/Agreements/policies/ExternalFacing_Services_Policy.pdf)\nand [AI AUP](https://www.salesforce.com/content/dam/web/en_us/www/documents/legal/Agreements/policies/ai-acceptable-use-policy.pdf).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalesforce%2Fcodegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalesforce%2Fcodegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalesforce%2Fcodegen/lists"}