language:
- code
pipeline_tag: text-generation
tags:
- llama-2
license: llama2
Opencsg-CodeLlama-7b-v0.1 [中文] [English]
[OpenCSG Community] [github] [wechat] [Twitter]
OpenCSG stands for Converged resources, Software refined, and Generative LM. The 'C' represents Converged resources, indicating the integration and full utilization of hybrid resources. The 'S' stands for Software refined, signifying software that is refined by large models. The 'G' represents Generative LM, which denotes widespread, inclusive, and democratized generative large models.The vision of OpenCSG is to empower every industry, every company, and every individual to own their models. We adhere to the principles of openness and open source, making the large model software stack of OpenCSG available to the community. We welcome everyone to use, feedback, and collaborative contribute.
Model Description
CodeLlama is a collection of pretrained and fine-tuned generative text models from Llama2, which ranges in scale from 7 billion to 34 billion parameters.
Based on CodeLlama, opencsg-CodeLlama-v0.1 is a series of fintuned models througth full-paramters fine-tuning method.
This is the repository for the base 7B version finetuned based on CodeLlama-7b-hf.
Model Size | Base Model |
---|---|
7B | opencsg/Opencsg-CodeLlama-7b-v0.1 |
13B | opencsg/Opencsg-CodeLlama-13b-v0.1 |
34B | opencsg/Opencsg-CodeLlama-34b-v0.1 |
Model Eval
HumanEval is the commonest code generation benchmark to evaluate the performance of models, especially on the the compeltion of code exercise cases. Somehow, model evaluation is a kind of metaphysics. Different models are sensitive to different decoding methods and paramters. It is impratical for us to manually set specific configuration for each fine-tuned model, because a real LLM should master the universal capability despite the parameters manipulated by users
Model | HumanEval python pass@1 |
---|---|
CodeLlama-7b-hf | 30.5% |
opencsg-CodeLlama-7b-v0.1(4k) | 42.7% |
CodeLlama-13b-hf | 36.0% |
opencsg-CodeLlama-13b-v0.1(4k) | 45.1% |
CodeLlama-34b-hf | 48.2% |
opencsg-CodeLlama-34b-v0.1(4k) | 48.8% |
from transformers import AutoTokenizer
import transformers
import torch
model = "opencsg/opencsg-CodeLlama-7b-v0.1"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
"text-generation",
model=model,
torch_dtype=torch.float16,
device_map="auto",
)
sequences = pipeline(
'import socket\n\ndef ping_exponential_backoff(host: str):',
do_sample=True,
top_k=10,
temperature=0.1,
top_p=0.95,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
max_length=200,
)
for seq in sequences:
print(f"Result: {seq['generated_text']}")
Model Details
*Note: Use of this model is governed by the Meta license. Meta developed and publicly released the Code Llama family of large language models (LLMs).
Model Developers Meta
Variations Code Llama comes in three model sizes, and three variants:
- Code Llama: base models designed for general code synthesis and understanding
- Code Llama - Python: designed specifically for Python
- Code Llama - Instruct: for instruction following and safer deployment
All variants are available in sizes of 7B, 13B and 34B parameters.
This repository contains the base model of 7B parameters.
Input Models input text only.
Output Models generate text only.
Model Architecture Code Llama is an auto-regressive language model that uses an optimized transformer architecture.
Model Dates Code Llama and its variants have been trained between January 2023 and July 2023.
Status This is a static model trained on an offline dataset. Future versions of Code Llama - Instruct will be released as we improve model safety with community feedback.
License A custom commercial license is available at: https://ai.meta.com/resources/models-and-libraries/llama-downloads/
Research Paper More information can be found in the paper "Code Llama: Open Foundation Models for Code" or it's arXiv page.
Intended Use
Intended Use Cases Code Llama and its variants is intended for commercial and research use in English and relevant programming languages. The base model Code Llama can be adapted for a variety of code synthesis and understanding tasks, Code Llama - Python is designed specifically to handle the Python programming language, and Code Llama - Instruct is intended to be safer to use for code assistant and generation applications.
Out-of-Scope Uses Use in any manner that violates applicable laws or regulations (including trade compliance laws). Use in languages other than English. Use in any other way that is prohibited by the Acceptable Use Policy and Licensing Agreement for Code Llama and its variants.
Hardware and Software
Training Factors We used custom training libraries. The training and fine-tuning of the released models have been performed Meta’s Research Super Cluster.
Carbon Footprint In aggregate, training all 9 Code Llama models required 400K GPU hours of computation on hardware of type A100-80GB (TDP of 350-400W). Estimated total emissions were 65.3 tCO2eq, 100% of which were offset by Meta’s sustainability program.
Training Data
All experiments reported here and the released models have been trained and fine-tuned using the same data as Llama 2 with different weights (see Section 2 and Table 1 in the research paper for details).
Evaluation Results
See evaluations for the main models and detailed ablations in Section 3 and safety evaluations in Section 4 of the research paper.
Ethical Considerations and Limitations
Code Llama and its variants are a new technology that carries risks with use. Testing conducted to date has been in English, and has not covered, nor could it cover all scenarios. For these reasons, as with all LLMs, Code Llama’s potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate or objectionable responses to user prompts. Therefore, before deploying any applications of Code Llama, developers should perform safety testing and tuning tailored to their specific applications of the model.
Please see the Responsible Use Guide available available at https://ai.meta.com/llama/responsible-use-guide.