Skip to content

Latest commit

 

History

History

codegen1

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

CodeGen1

Official research release for the CodeGen1 models (2B, 6B, 16B) for Program Synthesis as presented in ICLR 2023:

Title: CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis

Authors: Erik Nijkamp*, Bo Pang*, Hiroaki Hayashi*, Lifu Tu, Huan Wang, Yingbo Zhou, Silvio Savarese, and Caiming Xiong (* indicates equal contribution)

Hugging Face Integration

The models are available on the HuggingFace Hub.

Sampling

Program synthesis in the form of auto-regressive sampling can be performed as follows:

importtorchfromtransformersimportAutoTokenizer, AutoModelForCausalLMtokenizer=AutoTokenizer.from_pretrained("Salesforce/codegen-2B-mono") model=AutoModelForCausalLM.from_pretrained("Salesforce/codegen-2B-mono") inputs=tokenizer("# this function prints hello world", return_tensors="pt") sample=model.generate(**inputs, max_length=128) print(tokenizer.decode(sample[0], truncate_before_pattern=[r"\n\n^#", "^'''", "\n\n\n"]))

Citation

@article{nijkamp2022codegen, title={CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis}, author={Nijkamp, Erik and Pang, Bo and Hayashi, Hiroaki and Tu, Lifu and Wang, Huan and Zhou, Yingbo and Savarese, Silvio and Xiong, Caiming}, journal={ICLR}, year={2023} }
close