SuperAPIAI Directory

replit-code-v1-3b

huggingface.co · AI coding

replit-code-v1-3b is a 2.7B parameter causal language model developed by Replit, focused on code completion. The model was trained on a subset of the Stack Dedup v1.2 dataset, covering 20 programming languages, with a total of 175B tokens of training data, repeated for 3 epochs, totaling 525B tokens. The model was trained on the MosaicML platform using 256 A100-40GB GPUs, employing advanced techniques such as Flash Attention, AliBi positional embeddings, and the LionW optimizer. Replit hopes that this model can serve as a base model for fine-tuning for specific applications, and there are no strict restrictions on commercial use. The model checkpoints and vocabulary files are licensed under CC BY-SA-4.0, and the source code files are licensed under Apache 2.0. Users can download, explore the files, and run the model via Hugging Face, and a demo space and fine-tuning guide are also provided.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsWeb

About this tool

replit-code-v1-3b is a 2.7B parameter causal language model focused on code completion, developed by Replit. Its training data comes from a subset of the Stack Dedup v1.2 dataset, covering 20 programming languages, including, in descending order by token count, Markdown, Java, JavaScript, Python, TypeScript, PHP, SQL, JSX, reStructuredText, Rust, C, CSS, Go, C++, HTML, Vue, Ruby, Jupyter Notebook, R, and Shell. The training dataset totals 175B tokens, repeated for 3 epochs, for a total training volume of 525B tokens (approximately 195 tokens per parameter). The model was trained on the MosaicML platform using 256 A100-40GB GPUs, employing advanced techniques such as Flash Attention (accelerating training and inference), AliBi positional embeddings (supporting variable context lengths during inference), and the LionW optimizer.

In terms of main capabilities, the model is designed specifically for code completion tasks and supports multiple programming languages. Replit hopes that this model can serve as a base model for anyone to fine-tune for specific applications, and there are no strict restrictions on commercial use. The model uses a custom SentencePiece Unigram tokenizer, with a vocabulary optimized for code, containing 32768 tokens.

In terms of usage, users first need to install the latest versions of the dependencies, and then load the model through the Hugging Face Transformers library. Since ReplitLM is not a class in the Transformers library, trust_remote_code=True must be passed in the from_pretrained method. To use BF16 precision and the optimized Triton FlashAttention implementation on GPU, additional dependencies need to be installed and the model converted to bfloat16. The model also supports 8-bit and 4-bit quantized loading: 8-bit loading requires installing bitsandbytes and using load_in_8bit=True and device_map='auto'; 4-bit loading at the time of writing requires installing transformers and accelera from the main branchte dependencies. When generating code, it is recommended to try different decoding methods and parameters to achieve the best results. The post-processing step is important, including stopping generation when an EOS token is encountered, removing trailing whitespace, setting a reasonable max_tokens according to the use case, and truncating the generated result at stop words (such as return, def, "```", "\n\n\n") to avoid generating incomplete code.

Applicable scenarios include code completion, serving as a base model for domain-specific fine-tuning, and so on. In terms of limitations, the pretraining dataset may contain offensive or inappropriate content; even after data cleaning and filtering, such content may still be reflected in the text generated by the model. It is recommended to use it with caution in production systems and not to use it for applications that may cause harm or distress to individuals or groups. The model checkpoints and vocabulary files are licensed under CC BY-SA-4.0, requiring attribution to Replit, a link to the license, and an indication of whether changes were made; the source code files are licensed under Apache 2.0. The self-reported pass@1 result on HumanEval is 0.219.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools