Llama 2 is a collection of pretrained and fine-tuned generative text models ranging in scale from 7 billion to 70 billion parameters.
Meta developed and publicly released the Llama 2 family of large language models (LLMs), a collection of pretrained and fine-tuned generative text models ranging in scale from 7 billion to 70 billion parameters. Our fine-tuned LLMs, called Llama-2-Chat, are optimized for dialogue use cases. Llama-2-Chat models outperform open-source chat models on most benchmarks we tested, and in our human evaluations for helpfulness and safety, are on par with some popular closed-source models like ChatGPT and PaLM.
Training and evaluation data 📚
CodeAlpaca_20K
: contains 20K instruction-following data used for fine-tuning the Code Alpaca model.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
model_id = "mrm8488/llama-2-coder-7b"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id).to("cuda")
defcreate_prompt(instruction):
system = "You are a coding assistant that will help the user to resolve the following instruction:"
instruction = "### Instruction: " + instruction
return system + "\n" + instruction + "\n\n" + "### Solution:" + "\n"defgenerate(
instruction, max_new_tokens=128, temperature=0.1, top_p=0.75, top_k=40, num_beams=4, **kwargs,
):
prompt = create_prompt(instruction)
print(prompt)
inputs = tokenizer(prompt, return_tensors="pt")
input_ids = inputs["input_ids"].to("cuda")
attention_mask = inputs["attention_mask"].to("cuda")
generation_config = GenerationConfig(
temperature=temperature,
top_p=top_p,
top_k=top_k,
num_beams=num_beams,
**kwargs,
)
with torch.no_grad():
generation_output = model.generate(
input_ids=input_ids,
attention_mask=attention_mask,
generation_config=generation_config,
return_dict_in_generate=True,
output_scores=True,
max_new_tokens=max_new_tokens,
early_stopping=True
)
s = generation_output.sequences[0]
output = tokenizer.decode(s)
return output.split("### Solution:")[1].lstrip("\n")
instruction = """Edit the following XML code to add a navigation bar to the top of a web page<html><head> <title>CliBrAIn</title></head>"""print(generate(instruction))
Citation
@misc {manuel_romero_2023,
author = { {Manuel Romero} },
title = { llama-2-coder-7b (Revision d30d193) },
year = 2023,
url = { https://huggingface.co/mrm8488/llama-2-coder-7b },
doi = { 10.57967/hf/0931 },
publisher = { Hugging Face }
}
Runs of mrm8488 llama-2-coder-7b on huggingface.co
84
Total runs
-2
24-hour runs
0
3-day runs
3
7-day runs
29
30-day runs
More Information About llama-2-coder-7b huggingface.co Model
llama-2-coder-7b huggingface.co is an AI model on huggingface.co that provides llama-2-coder-7b's model effect (), which can be used instantly with this mrm8488 llama-2-coder-7b model. huggingface.co supports a free trial of the llama-2-coder-7b model, and also provides paid use of the llama-2-coder-7b. Support call llama-2-coder-7b model through api, including Node.js, Python, http.
llama-2-coder-7b huggingface.co is an online trial and call api platform, which integrates llama-2-coder-7b's modeling effects, including api services, and provides a free online trial of llama-2-coder-7b, you can try llama-2-coder-7b online for free by clicking the link below.
mrm8488 llama-2-coder-7b online free url in huggingface.co:
llama-2-coder-7b is an open source model from GitHub that offers a free installation service, and any user can find llama-2-coder-7b on GitHub to install. At the same time, huggingface.co provides the effect of llama-2-coder-7b install, users can directly use llama-2-coder-7b installed effect in huggingface.co for debugging and trial. It also supports api for free installation.