Package: colossalai
Colossal-AIColossal-AI: Making large AI models cheaper, faster, and more accessiblePaper|Documentation|Examples|Forum|Blog|English|中文|Latest News[2024/01]Inference Performance Improved by 46%, Open Source Solution Breaks the Length Limit of LLM for Multi-Round Conversations[2024/01]Construct Refined 13B Private Model With Just $5000 USD, Upgraded Colossal-AI Llama-2 Open Source[2023/11]Enhanced MoE Parallelism, Open-source MoE Model Training Can Be 9 Times More Efficient[2023/09]One Half-Day of Training Using a Few Hundred Dollars Yields Similar Results to Mainstream Large Models, Open-Source and Commercial-Free Domain-Specific LLM Solution[2023/09]70 Billion Parameter LLaMA2 Model Training Accelerated by 195%[2023/07]HPC-AI Tech Raises 22 Million USD in Series A Funding[2023/07]65B Model Pretraining Accelerated by 38%, Best Practices for Building LLaMA-Like Base Models Open-Source[2023/03]ColossalChat: An Open-Source Solution for Cloning ChatGPT With a Complete RLHF Pipeline[2023/03]Intel and Colossal-AI Partner to Deliver Cost-Efficient Open-Source Solution for Protein Folding Structure Prediction[2023/03]AWS and Google Fund Colossal-AI with Startup Cloud ProgramsTable of ContentsWhy Colossal-AIFeaturesColossal-AI for Real World ApplicationsColossal-LLaMA-2: One Half-Day of Training Using a Few Hundred Dollars Yields Similar Results to Mainstream Large Models, Open-Source and Commercial-Free Domain-Specific Llm SolutionColossalChat: An Open-Source Solution for Cloning ChatGPT With a Complete RLHF PipelineAIGC: Acceleration of Stable DiffusionBiomedicine: Acceleration of AlphaFold Protein StructureParallel Training DemoLLaMA 1/2MoEGPT-3GPT-2BERTPaLMOPTViTRecommendation System ModelsSingle GPU Training DemoGPT-2PaLMInferenceSwiftInfer:Breaks the Length Limit of LLM for Multi-Round Conversations with 46% AccelerationGPT-3OPT-175B Online Serving for Text Generation176B BLOOMInstallationPyPIInstall From SourceUse DockerCommunityContributingCite UsWhy Colossal-AIProf. James Demmel (UC Berkeley): Colossal-AI makes training AI models efficient, easy, and scalable.(back to top)FeaturesColossal-AI provides a collection of parallel components for you. We aim to support you to write your
distributed deep learning models just like how you write your model on your laptop. We provide user-friendly tools to kickstart
distributed training and inference in a few lines.Parallelism strategiesData ParallelismPipeline Parallelism1D,2D,2.5D,3DTensor ParallelismSequence ParallelismZero Redundancy Optimizer (ZeRO)Auto-ParallelismHeterogeneous Memory ManagementPatrickStarFriendly UsageParallelism based on the configuration file(back to top)Colossal-AI in the Real WorldColossal-LLaMA-27B: One half-day of training using a few hundred dollars yields similar results to mainstream large models, open-source and commercial-free domain-specific LLM solution.[code][blog][HuggingFace model weights][Modelscope model weights]13B: Construct refined 13B private model with just $5000 USD.[code][blog][HuggingFace model weights][Modelscope model weights]ModelBackboneTokens ConsumedMMLU (5-shot)CMMLU (5-shot)AGIEval (5-shot)GAOKAO (0-shot)CEval (5-shot)Baichuan-7B-1.2T42.32 (42.30)44.53 (44.02)38.7236.7442.80Baichuan-13B-Base-1.4T50.51 (51.60)55.73 (55.30)47.2051.4153.60Baichuan2-7B-Base-2.6T46.97 (54.16)57.67 (57.07)45.7652.6054.00Baichuan2-13B-Base-2.6T54.84 (59.17)62.62 (61.97)52.0858.2558.10ChatGLM-6B-1.0T39.67 (40.63)41.17 (-)40.1036.5338.90ChatGLM2-6B-1.4T44.74 (45.46)49.40 (-)46.3645.4951.70InternLM-7B-1.6T46.70 (51.00)52.00 (-)44.7761.6452.80Qwen-7B-2.2T54.29 (56.70)56.03 (58.80)52.4756.4259.60Llama-2-7B-2.0T44.47 (45.30)32.97 (-)32.6025.46-Linly-AI/Chinese-LLaMA-2-7B-hfLlama-2-7B1.0T37.4329.9232.0027.57-wenge-research/yayi-7b-llama2Llama-2-7B-38.5631.5230.9925.95-ziqingyang/chinese-llama-2-7bLlama-2-7B-33.8634.6934.5225.1834.2TigerResearch/tigerbot-7b-baseLlama-2-7B0.3T43.7342.0437.6430.61-LinkSoul/Chinese-Llama-2-7bLlama-2-7B-48.4138.3138.4527.72-FlagAlpha/Atom-7BLlama-2-7B0.1T49.9641.1039.8333.00-IDEA-CCNL/Ziya-LLaMA-13B-v1.1Llama-13B0.11T50.2540.9940.0430.54-Colossal-LLaMA-2-7b-baseLlama-2-7B0.0085T53.0649.8951.4858.8250.2Colossal-LLaMA-2-13b-baseLlama-2-13B0.025T56.4261.8054.6969.5360.3ColossalChatColossalChat: An open-source solution for cloningChatGPTwith a complete RLHF pipeline.[code][blog][demo][tutorial]Up to 10 times faster for RLHF PPO Stage3 TrainingUp to 7.73 times faster for single server training and 1.42 times faster for single-GPU inferenceUp to 10.3x growth in model capacity on one GPUA mini demo training process requires only 1.62GB of GPU memory (any consumer-grade GPU)Increase the capacity of the fine-tuning model by up to 3.7 times on a single GPUKeep at a sufficiently high running speed(back to top)AIGCAcceleration of AIGC (AI-Generated Content) models such asStable Diffusion v1andStable Diffusion v2.Training: Reduce Stable Diffusion memory consumption by up to 5.6x and hardware cost by up to 46x (from A100 to RTX3060).DreamBooth Fine-tuning: Personalize your model using just 3-5 images of the desired subject.Inference: Reduce inference GPU memory consumption by 2.5x.(back to top)BiomedicineAcceleration ofAlphaFold Protein StructureFastFold: Accelerating training and inference on GPU Clusters, faster data processing, inference sequence containing more than 10000 residues.FastFold with Intel: 3x inference acceleration and 39% cost reduce.xTrimoMultimer: accelerating structure prediction of protein monomers and multimer by 11x.(back to top)Parallel Training DemoLLaMA270 billion parameter LLaMA2 model training accelerated by 195%[code][blog]LLaMA165-billion-parameter large model pretraining accelerated by 38%[code][blog]MoEEnhanced MoE parallelism, Open-source MoE model training can be 9 times more efficient[code][blog]GPT-3Save 50% GPU resources and 10.7% accelerationGPT-211x lower GPU memory consumption, and superlinear scaling efficiency with Tensor Parallelism24x larger model size on the same hardwareover 3x accelerationBERT2x faster training, or 50% longer sequence lengthPaLMPaLM-colossalai: Scalable implementation of Google's Pathways Language Model (PaLM).OPTOpen Pretrained Transformer (OPT), a 175-Billion parameter AI language model released by Meta, which stimulates AI programmers to perform various downstream tasks and application deployments because of public pre-trained model weights.45% speedup fine-tuning OPT at low cost in lines.[Example][Online Serving]Please visit ourdocumentationandexamplesfor more details.ViT14x larger batch size, and 5x faster training for Tensor Parallelism = 64Recommendation System ModelsCached Embedding, utilize software cache to train larger embedding tables with a smaller GPU memory budget.(back to top)Single GPU Training DemoGPT-220x larger model size on the same hardware120x larger model size on the same hardware (RTX 3080)PaLM34x larger model size on the same hardware(back to top)InferenceSwiftInfer: Inference performance improved by 46%, open source solution breaks the length limit of LLM for multi-round conversationsEnergon-AI: 50% inference acceleration on the same hardwareOPT Serving: Try 175-billion-parameter OPT online servicesBLOOM: Reduce hardware deployment costs of 176-billion-parameter BLOOM by more than 10 times.(back to top)InstallationRequirements:PyTorch >= 1.11 and PyTorch <= 2.1Python >= 3.7CUDA >= 11.0NVIDIA GPU Compute Capability>= 7.0 (V100/RTX20 and higher)Linux OSIf you encounter any problem with installation, you may want to raise anissuein this repository.Install from PyPIYou can easily install Colossal-AI with the following command.By default, we do not build PyTorch extensions during installation.pipinstallcolossalaiNote: only Linux is supported for now.However, if you want to build the PyTorch extensions during installation, you can setCUDA_EXT=1.CUDA_EXT=1pipinstallcolossalaiOtherwise, CUDA kernels will be built during runtime when you actually need them.We also keep releasing the nightly version to PyPI every week. This allows you to access the unreleased features and bug fixes in the main branch.
Installation can be made viapipinstallcolossalai-nightlyDownload From SourceThe version of Colossal-AI will be in line with the main branch of the repository. Feel free to raise an issue if you encounter any problems. :)gitclonehttps://github.com/hpcaitech/ColossalAI.gitcdColossalAI# install colossalaipipinstall.By default, we do not compile CUDA/C++ kernels. ColossalAI will build them during runtime.
If you want to install and enable CUDA kernel fusion (compulsory installation when using fused optimizer):CUDA_EXT=1pipinstall.For Users with CUDA 10.2, you can still build ColossalAI from source. However, you need to manually download the cub library and copy it to the corresponding directory.# clone the repositorygitclonehttps://github.com/hpcaitech/ColossalAI.gitcdColossalAI# download the cub librarywgethttps://github.com/NVIDIA/cub/archive/refs/tags/1.8.0.zip
unzip1.8.0.zip
cp-rcub-1.8.0/cub/colossalai/kernel/cuda_native/csrc/kernels/include/# installCUDA_EXT=1pipinstall.(back to top)Use DockerPull from DockerHubYou can directly pull the docker image from ourDockerHub page. The image is automatically uploaded upon release.Build On Your OwnRun the following command to build a docker image from Dockerfile provided.Building Colossal-AI from scratch requires GPU support, you need to use Nvidia Docker Runtime as the default when doingdocker build. More details can be foundhere.
We recommend you install Colossal-AI from ourproject pagedirectly.cdColossalAI
dockerbuild-tcolossalai./dockerRun the following command to start the docker container in interactive mode.dockerrun-ti--gpusall--rm--ipc=hostcolossalaibash(back to top)CommunityJoin the Colossal-AI community onForum,Slack,
andWeChat(微信)to share your suggestions, feedback, and questions with our engineering team.ContributingReferring to the successful attempts ofBLOOMandStable Diffusion, any and all developers and partners with computing powers, datasets, models are welcome to join and build the Colossal-AI community, making efforts towards the era of big AI models!You may contact us or participate in the following ways:Leaving a Star ⭐to show your like and support. Thanks!Posting anissue, or submitting a PR on GitHub follow the guideline inContributingSend your official proposal to emailcontact@hpcaitech.comThanks so much to all of our amazing contributors!(back to top)CI/CDWe leverage the power ofGitHub Actionsto automate our development, release and deployment workflows. Please check out thisdocumentationon how the automated workflows are operated.Cite UsThis project is inspired by some related projects (some by our team and some by other organizations). We would like to credit these amazing projects as listed in theReference List.To cite this project, you can use the following BibTeX citation.@inproceedings{10.1145/3605573.3605613,
author = {Li, Shenggui and Liu, Hongxin and Bian, Zhengda and Fang, Jiarui and Huang, Haichen and Liu, Yuliang and Wang, Boxiang and You, Yang},
title = {Colossal-AI: A Unified Deep Learning System For Large-Scale Parallel Training},
year = {2023},
isbn = {9798400708435},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3605573.3605613},
doi = {10.1145/3605573.3605613},
abstract = {The success of Transformer models has pushed the deep learning model scale to billions of parameters, but the memory limitation of a single GPU has led to an urgent need for training on multi-GPU clusters. However, the best practice for choosing the optimal parallel strategy is still lacking, as it requires domain expertise in both deep learning and parallel computing. The Colossal-AI system addressed the above challenge by introducing a unified interface to scale your sequential code of model training to distributed environments. It supports parallel training methods such as data, pipeline, tensor, and sequence parallelism and is integrated with heterogeneous training and zero redundancy optimizer. Compared to the baseline system, Colossal-AI can achieve up to 2.76 times training speedup on large-scale models.},
booktitle = {Proceedings of the 52nd International Conference on Parallel Processing},
pages = {766–775},
numpages = {10},
keywords = {datasets, gaze detection, text tagging, neural networks},
location = {Salt Lake City, UT, USA},
series = {ICPP '23}
}Colossal-AI has been accepted as official tutorial by top conferencesNeurIPS,SC,AAAI,PPoPP,CVPR,ISC,NVIDIA GTC,etc.(back to top)