From 6075f445b0062f9f4d957539a432d1841511587b Mon Sep 17 00:00:00 2001 From: smalltong02 Date: Thu, 18 Apr 2024 13:45:19 -0700 Subject: [PATCH 1/3] Starting the AI generator. --- WebUI/webui_pages/ai_generator/__init__.py | 0 WebUI/webui_pages/ai_generator/aigenerator.py | 11 +++++++++++ webui.py | 5 +++++ 3 files changed, 16 insertions(+) create mode 100644 WebUI/webui_pages/ai_generator/__init__.py create mode 100644 WebUI/webui_pages/ai_generator/aigenerator.py diff --git a/WebUI/webui_pages/ai_generator/__init__.py b/WebUI/webui_pages/ai_generator/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/WebUI/webui_pages/ai_generator/aigenerator.py b/WebUI/webui_pages/ai_generator/aigenerator.py new file mode 100644 index 0000000..d9c47b3 --- /dev/null +++ b/WebUI/webui_pages/ai_generator/aigenerator.py @@ -0,0 +1,11 @@ +import streamlit as st +from WebUI.webui_pages.utils import ApiRequest + + +def ai_generator_page(api: ApiRequest, is_lite: bool = False): + + st.session_state["current_page"] = "ai_generator_page" + + if st.session_state.get("need_rerun"): + st.session_state["need_rerun"] = False + st.rerun() \ No newline at end of file diff --git a/webui.py b/webui.py index 70a2d36..895d08b 100644 --- a/webui.py +++ b/webui.py @@ -9,6 +9,7 @@ from WebUI.webui_pages.dialogue.dialogue import dialogue_page from WebUI.webui_pages.model_configuration.configuration import configuration_page from WebUI.webui_pages.tools_agent.toolsagent import tools_agent_page +from WebUI.webui_pages.ai_generator.aigenerator import ai_generator_page def api_address() -> str: host = API_SERVER["host"] @@ -46,6 +47,10 @@ def api_address() -> str: "icon": "archive-fill", "func": tools_agent_page, }, + "AI Generator": { + "icon": "bi bi-robot", + "func": ai_generator_page, + } } with st.sidebar: From 334fcb99addae6614fafd5cc4859b724bfea8fc9 Mon Sep 17 00:00:00 2001 From: smalltong02 Date: Thu, 18 Apr 2024 21:10:45 -0700 Subject: [PATCH 2/3] support role player feature. --- WebUI/configs/__init__.py | 1 + WebUI/configs/basicconfig.py | 1 + WebUI/configs/roleplaytemplates.py | 175 ++++++++++++++++++ WebUI/configs/specialmodels.py | 4 +- WebUI/webui_pages/ai_generator/aigenerator.py | 31 ++++ WebUI/webui_pages/dialogue/dialogue.py | 12 ++ .../model_configuration/configuration.py | 64 ++++++- WebUI/webui_pages/tools_agent/toolsagent.py | 5 +- 8 files changed, 280 insertions(+), 13 deletions(-) create mode 100644 WebUI/configs/roleplaytemplates.py diff --git a/WebUI/configs/__init__.py b/WebUI/configs/__init__.py index ecdeff1..ae5385c 100644 --- a/WebUI/configs/__init__.py +++ b/WebUI/configs/__init__.py @@ -3,3 +3,4 @@ from .basicconfig import * from .prompttemplates import * from .kbconfig import * +from .roleplaytemplates import * diff --git a/WebUI/configs/basicconfig.py b/WebUI/configs/basicconfig.py index 82cda41..931d79b 100644 --- a/WebUI/configs/basicconfig.py +++ b/WebUI/configs/basicconfig.py @@ -17,6 +17,7 @@ glob_model_type_list = ["LLM Model","Multimodal Model", "Code Model", "Special Model","Online Model"] glob_model_size_list = ["3B Model","7B Model","13B Model","34B Model","70B Model"] glob_model_subtype_list = ["Vision Chat Model","Voice Chat Model","Video Chat Model"] +glob_roleplay_list = [""] class ModelType(Enum): Unknown = 0 diff --git a/WebUI/configs/roleplaytemplates.py b/WebUI/configs/roleplaytemplates.py new file mode 100644 index 0000000..0565794 --- /dev/null +++ b/WebUI/configs/roleplaytemplates.py @@ -0,0 +1,175 @@ +ROLEPLAY_TEMPLATES = { + "English Translator": { + "system": """ + I want you to act as an English translator, spelling corrector and improver. I will speak to you in any language and you will detect the language, translate it and answer in the corrected and improved version of my text, in English. I want you to replace my simplified A0-level words and sentences with more beautiful and elegant, upper level English words and sentences. Keep the meaning same, but make them more literary. I want you to only reply the correction, the improvements and nothing else, do not write explanations. + """ + }, + + "Interviewer": { + "system": """ + I want you to act as an interviewer. I will be the candidate and you will ask me the interview questions for the `position` position. I want you to only reply as the interviewer. Do not write all the conservation at once. I want you to only do the interview with me. Ask me the questions and wait for my answers. Do not write explanations. Ask me the questions one by one like an interviewer does and wait for my answers. + """ + }, + + "Spoken English Teacher": { + "system": """ + I want you to act as a spoken English teacher and improver. I will speak to you in English and you will reply to me in English to practice my spoken English. I want you to keep your reply neat, limiting the reply to 100 words. I want you to strictly correct my grammar mistakes, typos, and factual errors. I want you to ask me a question in your reply. Now let's start practicing. Remember, I want you to strictly correct my grammar mistakes, typos, and factual errors. + """ + }, + + "Travel Guide": { + "system": """ + I want you to act as a travel guide. I will write you my location and you will suggest a place to visit near my location. In some cases, I will also give you the type of places I will visit. You will also suggest me places of similar type that are close to my first location. + """ + }, + + "Advertiser": { + "system": """ + I want you to act as an advertiser. You will create a campaign to promote a product or service of your choice. You will choose a target audience, develop key messages and slogans, select the media channels for promotion, and decide on any additional activities needed to reach your goals. + """ + }, + + "Storyteller": { + "system": """ + I want you to act as a storyteller. You will come up with entertaining stories that are engaging, imaginative and captivating for the audience. It can be fairy tales, educational stories or any other type of stories which has the potential to capture people's attention and imagination. Depending on the target audience, you may choose specific themes or topics for your storytelling session e.g., if it’s children then you can talk about animals; If it’s adults then history-based tales might engage them better etc. + """ + }, + + "Stand-up Comedian": { + "system": """ + I want you to act as a stand-up comedian. I will provide you with some topics related to current events and you will use your wit, creativity, and observational skills to create a routine based on those topics. You should also be sure to incorporate personal anecdotes or experiences into the routine in order to make it more relatable and engaging for the audience. + """ + }, + + "Debater": { + "system": """ + I want you to act as a debater. I will provide you with some topics related to current events and your task is to research both sides of the debates, present valid arguments for each side, refute opposing points of view, and draw persuasive conclusions based on evidence. Your goal is to help people come away from the discussion with increased knowledge and insight into the topic at hand. + """ + }, + + "Screenwriter": { + "system": """ + I want you to act as a screenwriter. You will develop an engaging and creative script for either a feature length film, or a Web Series that can captivate its viewers. Start with coming up with interesting characters, the setting of the story, dialogues between the characters etc. Once your character development is complete - create an exciting storyline filled with twists and turns that keeps the viewers in suspense until the end. + """ + }, + + "Novelist": { + "system": """ + I want you to act as a novelist. You will come up with creative and captivating stories that can engage readers for long periods of time. You may choose any genre such as fantasy, romance, historical fiction and so on - but the aim is to write something that has an outstanding plotline, engaging characters and unexpected climaxes. + """ + }, + + "Movie Critic": { + "system": """ + I want you to act as a movie critic. You will develop an engaging and creative movie review. You can cover topics like plot, themes and tone, acting and characters, direction, score, cinematography, production design, special effects, editing, pace, dialog. The most important aspect though is to emphasize how the movie has made you feel. What has really resonated with you. You can also be critical about the movie. Please avoid spoilers. + """ + }, + + "Poet": { + "system": """ + I want you to act as a poet. You will create poems that evoke emotions and have the power to stir people’s soul. Write on any topic or theme but make sure your words convey the feeling you are trying to express in beautiful yet meaningful ways. You can also come up with short verses that are still powerful enough to leave an imprint in readers' minds. + """ + }, + + "Rapper": { + "system": """ + I want you to act as a rapper. You will come up with powerful and meaningful lyrics, beats and rhythm that can ‘wow’ the audience. Your lyrics should have an intriguing meaning and message which people can relate too. When it comes to choosing your beat, make sure it is catchy yet relevant to your words, so that when combined they make an explosion of sound everytime! + """ + }, + + "Motivational Speaker": { + "system": """ + I want you to act as a motivational speaker. Put together words that inspire action and make people feel empowered to do something beyond their abilities. You can talk about any topics but the aim is to make sure what you say resonates with your audience, giving them an incentive to work on their goals and strive for better possibilities. + """ + }, + + "Math Teacher": { + "system": """ + I want you to act as a math teacher. I will provide some mathematical equations or concepts, and it will be your job to explain them in easy-to-understand terms. This could include providing step-by-step instructions for solving a problem, demonstrating various techniques with visuals or suggesting online resources for further study. + """ + }, + + "Career Counselor": { + "system": """ + I want you to act as a career counselor. I will provide you with an individual looking for guidance in their professional life, and your task is to help them determine what careers they are most suited for based on their skills, interests and experience. You should also conduct research into the various options available, explain the job market trends in different industries and advice on which qualifications would be beneficial for pursuing particular fields. + """ + }, + + "Doctor": { + "system": """ + I want you to act as a doctor and come up with creative treatments for illnesses or diseases. You should be able to recommend conventional medicines, herbal remedies and other natural alternatives. You will also need to consider the patient’s age, lifestyle and medical history when providing your recommendations. + """ + }, + + "Dentist": { + "system": """ + I want you to act as a dentist. I will provide you with details on an individual looking for dental services such as x-rays, cleanings, and other treatments. Your role is to diagnose any potential issues they may have and suggest the best course of action depending on their condition. You should also educate them about how to properly brush and floss their teeth, as well as other methods of oral care that can help keep their teeth healthy in between visits. + """ + }, + + "Chef": { + "system": """ + I require someone who can suggest delicious recipes that includes foods which are nutritionally beneficial but also easy & not time consuming enough therefore suitable for busy people like us among other factors such as cost effectiveness so overall dish ends up being healthy yet economical at same time! + """ + }, + + "Automobile Mechanic": { + "system": """ + Need somebody with expertise on automobiles regarding troubleshooting solutions like; diagnosing problems/errors present both visually & within engine parts in order to figure out what's causing them (like lack of oil or power issues) & suggest required replacements while recording down details such fuel consumption type etc. + """ + }, + + "Text Based Adventure Game": { + "system": """ + I want you to act as a text based adventure game. I will type commands and you will reply with a description of what the character sees. I want you to only reply with the game output inside one unique code block, and nothing else. do not write explanations. do not type commands unless I instruct you to do so. when i need to tell you something in english, i will do so by putting text inside curly brackets {like this}. + """ + }, + + "Fancy Title Generator": { + "system": """ + I want you to act as a fancy title generator. I will type keywords via comma and you will reply with fancy titles. + """ + }, + + "Yogi": { + "system": """ + I want you to act as a yogi. You will be able to guide students through safe and effective poses, create personalized sequences that fit the needs of each individual, lead meditation sessions and relaxation techniques, foster an atmosphere focused on calming the mind and body, give advice about lifestyle adjustments for improving overall wellbeing. + """ + }, + + "Essay Writer": { + "system": """ + I want you to act as an essay writer. You will need to research a given topic, formulate a thesis statement, and create a persuasive piece of work that is both informative and engaging. Please provide a detailed outline of the essay, including the structure, formatting, and any specific references or sources that will be cited. + """ + }, + + "Food Critic": { + "system": """ + I want you to act as a food critic. I will tell you about a restaurant and you will provide a review of the food and service. You should only reply with your review, and nothing else. Do not write explanations. + """ + }, + + "Machine Learning Engineer": { + "system": """ + I want you to act as a machine learning engineer. I will write some machine learning concepts and it will be your job to explain them in easy-to-understand terms. This could contain providing step-by-step instructions for building a model, demonstrating various techniques with visuals, or suggesting online resources for further study. + """ + }, + + "Regex Generator": { + "system": """ + I want you to act as a regex generator. Your role is to generate regular expressions that match specific patterns in text. You should provide the regular expressions in a format that can be easily copied and pasted into a regex-enabled text editor or programming language. Do not write explanations or examples of how the regular expressions work; simply provide only the regular expressions themselves. + """ + }, + + "Startup Idea Generator": { + "system": """ + Generate digital startup ideas based on the wish of the people. For example, when I say "I wish there's a big large mall in my small town", you generate a business plan for the digital startup complete with idea name, a short one liner, target user persona, user's pain points to solve, main value propositions, sales & marketing channels, revenue stream sources, cost structures, key activities, key resources, key partners, idea validation steps, estimated 1st year cost of operation, and potential business challenges to look for. Write the result in a markdown table. + """ + }, + + "Product Manager": { + "system": """ + Please acknowledge my following request. Please respond to me as a product manager. I will ask for subject, and you will help me writing a PRD for it with these heders: Subject, Introduction, Problem Statement, Goals and Objectives, User Stories, Technical requirements, Benefits, KPIs, Development Risks, Conclusion. Do not write any PRD until I ask for one on a specific subject, feature pr development. + """ + } +} \ No newline at end of file diff --git a/WebUI/configs/specialmodels.py b/WebUI/configs/specialmodels.py index 720afd1..85e1ae9 100644 --- a/WebUI/configs/specialmodels.py +++ b/WebUI/configs/specialmodels.py @@ -208,7 +208,7 @@ def running_chain(chain, input_variables, query): genai.configure(api_key=apikey) model = genai.GenerativeModel(model_name=model_name) updated_history = [ - {'parts': entry['content'], **({'role': 'model'} if entry['role'] == 'assistant' else {'role': entry['role']})} + {'parts': entry['content'], **({'role': 'model'} if entry['role'] == 'assistant' else {'role': "user"})} for entry in history ] @@ -991,7 +991,7 @@ async def special_search_chat_iterator(model: Any, genai.configure(api_key=apikey) model = genai.GenerativeModel(model_name=model_name) updated_history = [ - {'parts': entry['content'], **({'role': 'model'} if entry['role'] == 'assistant' else {'role': entry['role']})} + {'parts': entry['content'], **({'role': 'model'} if entry['role'] == 'assistant' else {'role': "user"})} for entry in history ] prompt_template = get_prompt_template("search_engine_chat", prompt_name) diff --git a/WebUI/webui_pages/ai_generator/aigenerator.py b/WebUI/webui_pages/ai_generator/aigenerator.py index d9c47b3..cfad0af 100644 --- a/WebUI/webui_pages/ai_generator/aigenerator.py +++ b/WebUI/webui_pages/ai_generator/aigenerator.py @@ -4,6 +4,37 @@ def ai_generator_page(api: ApiRequest, is_lite: bool = False): + running_model = "" + models_list = list(api.get_running_models()) + if len(models_list): + running_model = models_list[0] + webui_config = api.get_webui_config() + current_voice_model = api.get_vtot_model() + current_speech_model = api.get_ttov_model() + current_imagere_model = api.get_image_recognition_model() + current_imagegen_model = api.get_image_generation_model() + current_musicgen_model = api.get_music_generation_model() + voicemodel = None + + if running_model == "": + running_model = "None" + + tabtexttask, tabspetask, tabimgtask, tabvidtask, tabcodtask = st.tabs(["Text Creation", "Voice Creation", "Image Creation", "Video Creation", "Code Creation"]) + with tabtexttask: + pass + + with tabspetask: + pass + + with tabimgtask: + pass + + with tabvidtask: + pass + + with tabcodtask: + pass + st.session_state["current_page"] = "ai_generator_page" if st.session_state.get("need_rerun"): diff --git a/WebUI/webui_pages/dialogue/dialogue.py b/WebUI/webui_pages/dialogue/dialogue.py index 16dfff2..3058abe 100644 --- a/WebUI/webui_pages/dialogue/dialogue.py +++ b/WebUI/webui_pages/dialogue/dialogue.py @@ -13,6 +13,7 @@ from WebUI.configs.basicconfig import (TMP_DIR, ModelType, ModelSize, ModelSubType, GetModelInfoByName, GetTypeName, generate_prompt_for_imagegen, generate_prompt_for_smart_search, use_search_engine, glob_multimodal_vision_list, glob_multimodal_voice_list, glob_multimodal_video_list) from WebUI.configs.prompttemplates import PROMPT_TEMPLATES +from WebUI.configs.roleplaytemplates import ROLEPLAY_TEMPLATES from io import BytesIO from typing import List, Dict, Any @@ -134,6 +135,7 @@ def dialogue_page(api: ApiRequest, is_lite: bool = False): current_smart = False current_search_engine = {} code_interpreter = {} + role_player = {} if st.session_state.get("current_search_engine"): current_search_engine = st.session_state["current_search_engine"] current_engine_name = current_search_engine["engine"] @@ -141,6 +143,9 @@ def dialogue_page(api: ApiRequest, is_lite: bool = False): if st.session_state.get("current_interpreter"): current_interpreter = st.session_state["current_interpreter"] code_interpreter = current_interpreter["interpreter"] + if st.session_state.get("current_roleplayer"): + current_role_player = st.session_state["current_roleplayer"] + role_player = current_role_player["roleplayer"] modelinfo : Dict[str, any] = {"mtype": ModelType.Unknown, "msize": ModelSize.Unknown, "msubtype": ModelSubType.Unknown, "mname": str} print("voicemodel: ", voicemodel) print("imagerecognition_model: ", imagerecognition_model) @@ -148,6 +153,7 @@ def dialogue_page(api: ApiRequest, is_lite: bool = False): print("musicgeneration_model: ", musicgeneration_model) print("search_engine: ", current_search_engine) print("code_interpreter: ", code_interpreter) + print("role_player: ", role_player) dialogue_turns = chatconfig.get("dialogue_turns", 5) disabled = False @@ -598,6 +604,12 @@ def on_feedback( new_prompt = generate_prompt_for_smart_search(prompt) else: new_prompt = prompt + if role_player: + role_template = ROLEPLAY_TEMPLATES[role_player]["system"] + history = [{ + 'content': f'{role_template}', + 'role': 'system' + }] + history r = api.chat_chat(new_prompt, imagesdata=imagesdata, audiosdata=audiosdata, diff --git a/WebUI/webui_pages/model_configuration/configuration.py b/WebUI/webui_pages/model_configuration/configuration.py index 0e57499..72cb702 100644 --- a/WebUI/webui_pages/model_configuration/configuration.py +++ b/WebUI/webui_pages/model_configuration/configuration.py @@ -1,6 +1,6 @@ import streamlit as st from WebUI.webui_pages.utils import ApiRequest -from WebUI.configs import (ModelType, ModelSize, ModelSubType, GetModelType, GetModelInfoByName, GetModelConfig, GetModelSubType, GetOnlineProvider, GetOnlineModelList, GetModeList, LocalModelExist, GetPresetPromptList, +from WebUI.configs import (ROLEPLAY_TEMPLATES, ModelType, ModelSize, ModelSubType, GetModelType, GetModelInfoByName, GetModelConfig, GetModelSubType, GetOnlineProvider, GetOnlineModelList, GetModeList, LocalModelExist, GetPresetPromptList, glob_model_type_list, glob_model_size_list, glob_model_subtype_list) from WebUI.webui_pages.utils import check_error_msg, check_success_msg from typing import Dict @@ -186,7 +186,7 @@ def configuration_page(api: ApiRequest, is_lite: bool = False): if current_model["config"]: preset_list = GetPresetPromptList() if current_model["mtype"] == ModelType.Local or current_model["mtype"] == ModelType.Multimodal or current_model["mtype"] == ModelType.Special or current_model["mtype"] == ModelType.Code: - tabparams, tabquant, tabtunning, tabsearch, tabprompt = st.tabs(["Parameters", "Quantization", "Fine-Tunning", "Search Engine", "Prompt Templates"]) + tabparams, tabquant, tabtunning, tabsearch, tabroleplay = st.tabs(["Parameters", "Quantization", "Fine-Tunning", "Search Engine", "Role Player"]) with tabparams: with st.form("Parameter"): col1, col2 = st.columns(2) @@ -416,11 +416,36 @@ def configuration_page(api: ApiRequest, is_lite: bool = False): st.session_state["current_search_engine"] = {"engine": current_search_engine, "smart": smart_search} else: st.session_state["current_search_engine"] = {} - with tabprompt: - pass + with tabroleplay: + roleplay_list = list(ROLEPLAY_TEMPLATES.keys()) + current_roleplay_state = st.session_state.get("current_roleplayer", {}) + if current_roleplay_state: + role_enable = True + role_index = roleplay_list.index(current_roleplay_state["roleplayer"]) + else: + role_index = 0 + role_enable = False + with st.form("Roleplay"): + current_roleplayer = st.selectbox( + "Please Select Role Player", + roleplay_list, + index=role_index, + ) + role_enable = st.checkbox("Enable", value=role_enable, help="After enabling, The Role Play feature will activate.") + save_parameters = st.form_submit_button( + "Save Parameters", + use_container_width=True + ) + if save_parameters: + with st.spinner("Saving Parameters, Please do not perform any actions or refresh the page."): + if role_enable: + st.session_state["current_roleplayer"] = {"roleplayer": current_roleplayer} + else: + st.session_state["current_roleplayer"] = {} + st.toast("success save configuration for Code Interpreter.", icon="✔") elif current_model["mtype"] == ModelType.Online: - tabparams, tabapiconfig, tabsearch, tabprompt = st.tabs(["Parameters", "API Config", "Search Engine", "Prompt Templates"]) + tabparams, tabapiconfig, tabsearch, tabroleplay = st.tabs(["Parameters", "API Config", "Search Engine", "Role Player"]) with tabparams: with st.form("Parameters"): col1, col2 = st.columns(2) @@ -532,8 +557,33 @@ def configuration_page(api: ApiRequest, is_lite: bool = False): else: st.session_state["current_search_engine"] = {} - with tabprompt: - pass + with tabroleplay: + roleplay_list = list(ROLEPLAY_TEMPLATES.keys()) + current_roleplay_state = st.session_state.get("current_roleplayer", {}) + if current_roleplay_state: + role_enable = True + role_index = roleplay_list.index(current_roleplay_state["roleplayer"]) + else: + role_index = 0 + role_enable = False + with st.form("Roleplay"): + current_roleplayer = st.selectbox( + "Please Select Role Player", + roleplay_list, + index=role_index, + ) + role_enable = st.checkbox("Enable", value=role_enable, help="After enabling, The Role Play feature will activate.") + save_parameters = st.form_submit_button( + "Save Parameters", + use_container_width=True + ) + if save_parameters: + with st.spinner("Saving Parameters, Please do not perform any actions or refresh the page."): + if role_enable: + st.session_state["current_roleplayer"] = {"roleplayer": current_roleplayer} + else: + st.session_state["current_roleplayer"] = {} + st.toast("success save configuration for Code Interpreter.", icon="✔") st.session_state["current_page"] = "configuration_page" diff --git a/WebUI/webui_pages/tools_agent/toolsagent.py b/WebUI/webui_pages/tools_agent/toolsagent.py index e76d5de..37a5d02 100644 --- a/WebUI/webui_pages/tools_agent/toolsagent.py +++ b/WebUI/webui_pages/tools_agent/toolsagent.py @@ -68,10 +68,7 @@ def tools_agent_page(api: ApiRequest, is_lite: bool = False): if running_model == "": running_model = "None" - st.caption( - f"""

Running LLM Model: {running_model}

""", - unsafe_allow_html=True, - ) + tabretrieval, tabinterpreter, tabspeech, tabvoice, tabimager, tabimageg, tabmusic = st.tabs(["Retrieval", "Code Interpreter", "Text-to-Voice", "Voice-to-Text", "Image Recognition", "Image Generation", "Music"]) with tabretrieval: kb_list = {} From 7cd3682a6348a4989f270d2b3e207f47a4ef31b9 Mon Sep 17 00:00:00 2001 From: smalltong02 Date: Fri, 19 Apr 2024 19:09:28 -0700 Subject: [PATCH 3/3] add role player feature and support english and chinese roles. --- WebUI/configs/basicconfig.py | 48 +- WebUI/configs/roleplaytemplates.py | 383 +++++++-- WebUI/configs/specialmodels.py | 8 +- WebUI/configs/webuiconfig.json | 30 +- WebUI/webui_pages/dialogue/dialogue.py | 6 +- .../model_configuration/configuration.py | 51 +- models/llm/Meta-Llama-3-8B-Instruct/README.md | 809 ++++++++++++++++++ models/llm/Meta-Llama-3-8B/README.md | 735 ++++++++++++++++ readme-cn.md | 49 +- readme.md | 47 +- 10 files changed, 2046 insertions(+), 120 deletions(-) create mode 100644 models/llm/Meta-Llama-3-8B-Instruct/README.md create mode 100644 models/llm/Meta-Llama-3-8B/README.md diff --git a/WebUI/configs/basicconfig.py b/WebUI/configs/basicconfig.py index 931d79b..2f957ab 100644 --- a/WebUI/configs/basicconfig.py +++ b/WebUI/configs/basicconfig.py @@ -433,36 +433,36 @@ def generate_prompt_for_imagegen(model_name : str = "", prompt : str = "", image new_prompt = "" if len(model_name) == 0 or len(prompt) == 0: return prompt - if model_name == "OpenDalleV1.1" or model_name == "ProteusV0.2": - new_prompt = """ - You need to create prompts for an image generation model based on the user's question. The format of the prompts is the features of the image, separated by commas, with no any other information outputted, for example: - - 1. black fluffy gorgeous dangerous cat animal creature, large orange eyes, big fluffy ears, piercing gaze, full moon, dark ambiance, best quality, extremely detailed - 2. an anime female general laughing, with a military cap, evil smile, sadistic, grim - 3. John Berkey Style page,ral-oilspill, There is no road ahead,no land, Strangely,the river is still flowing,crossing the void into the mysterious unknown, The end of nothingness,a huge ripple,it is a kind of wave,and it is the law of time that lasts forever in that void, At the end of the infinite void,there is a colorful world,very hazy and mysterious,and it cannot be seen clearly,but it is real, And that's where the river goes - 4. (impressionistic realism by csybgh), a 50 something male, working in banking, very short dyed dark curly balding hair, Afro-Asiatic ancestry, talks a lot but listens poorly, stuck in the past, wearing a suit, he has a certain charm, bronze skintone, sitting in a bar at night, he is smoking and feeling cool, drunk on plum wine, masterpiece, 8k, hyper detailed, smokey ambiance, perfect hands AND fingers - 5. Super Closeup Portrait, action shot, Profoundly dark whitish meadow, glass flowers, Stains, space grunge style, Jeanne d'Arc wearing White Olive green used styled Cotton frock, Wielding thin silver sword, Sci-fi vibe, dirty, noisy, Vintage monk style, very detailed, hd - 6. cinematic film still of Kodak Motion Picture Film: (Sharp Detailed Image) An Oscar winning movie for Best Cinematography a woman in a kimono standing on a subway train in Japan Kodak Motion Picture Film Style, shallow depth of field, vignette, highly detailed, high budget, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy - 7. in the style of artgerm, comic style,3D model, mythical seascape, negative space, space quixotic dreams, temporal hallucination, psychedelic, mystical, intricate details, very bright neon colors, (vantablack background:1.5), pointillism, pareidolia, melting, symbolism, very high contrast, chiaroscuro bad quality, bad anatomy, worst quality, low quality, low resolutions, extra fingers, blur, blurry, ugly, wrongs proportions, watermark, image artifacts, lowres, ugly, jpeg artifacts, deformed, noisy image - 8. ((OpenDAlle!)text logo:1), ~*~aesthetic~*~ - \n - Please generate appropriate prompts for the user's question based on the above example. Please note do not reply to what I say. that the format should only consist of features separated by commas, with no any other information outputted, Just output a prompt. - \n - """ - - new_prompt += "The user's question is: " + prompt - if imagesprompt: - new_prompt += f". Contents of this image is '{imagesprompt}'" - print("new_prompt: ", new_prompt) - return new_prompt, True - return prompt, False + #if model_name == "OpenDalleV1.1" or model_name == "ProteusV0.2": + new_prompt = """ + You need to create prompts for an image generation model based on the user's question. The format of the prompts is the features of the image, separated by commas, with no any other information outputted, for example: + + 1. black fluffy gorgeous dangerous cat animal creature, large orange eyes, big fluffy ears, piercing gaze, full moon, dark ambiance, best quality, extremely detailed + 2. an anime female general laughing, with a military cap, evil smile, sadistic, grim + 3. John Berkey Style page,ral-oilspill, There is no road ahead,no land, Strangely,the river is still flowing,crossing the void into the mysterious unknown, The end of nothingness,a huge ripple,it is a kind of wave,and it is the law of time that lasts forever in that void, At the end of the infinite void,there is a colorful world,very hazy and mysterious,and it cannot be seen clearly,but it is real, And that's where the river goes + 4. (impressionistic realism by csybgh), a 50 something male, working in banking, very short dyed dark curly balding hair, Afro-Asiatic ancestry, talks a lot but listens poorly, stuck in the past, wearing a suit, he has a certain charm, bronze skintone, sitting in a bar at night, he is smoking and feeling cool, drunk on plum wine, masterpiece, 8k, hyper detailed, smokey ambiance, perfect hands AND fingers + 5. Super Closeup Portrait, action shot, Profoundly dark whitish meadow, glass flowers, Stains, space grunge style, Jeanne d'Arc wearing White Olive green used styled Cotton frock, Wielding thin silver sword, Sci-fi vibe, dirty, noisy, Vintage monk style, very detailed, hd + 6. cinematic film still of Kodak Motion Picture Film: (Sharp Detailed Image) An Oscar winning movie for Best Cinematography a woman in a kimono standing on a subway train in Japan Kodak Motion Picture Film Style, shallow depth of field, vignette, highly detailed, high budget, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy + 7. in the style of artgerm, comic style,3D model, mythical seascape, negative space, space quixotic dreams, temporal hallucination, psychedelic, mystical, intricate details, very bright neon colors, (vantablack background:1.5), pointillism, pareidolia, melting, symbolism, very high contrast, chiaroscuro bad quality, bad anatomy, worst quality, low quality, low resolutions, extra fingers, blur, blurry, ugly, wrongs proportions, watermark, image artifacts, lowres, ugly, jpeg artifacts, deformed, noisy image + 8. ((OpenDAlle!)text logo:1), ~*~aesthetic~*~ + \n + Please generate appropriate prompts for the user's question based on the above example. Please note do not reply to what I say. that the format should only consist of features separated by commas, with no any other information outputted, Just output a prompt. + \n + """ + + new_prompt += "The user's question is: " + prompt + if imagesprompt: + new_prompt += f". Contents of this image is '{imagesprompt}'" + print("new_prompt: ", new_prompt) + return new_prompt, True + #return prompt, False def generate_prompt_for_smart_search(prompt : str = ""): new_prompt = "You are an AI assistant, answering questions based on user inquiries. If you are absolutely certain of the answer to the question, please answer it to the best of your ability and refrain from returning the 'search_engine' command. If you don't know how to answer the question or you require real-time information or need to search the internet before answering questions, then please only return the command: 'search_engine'. \n\n User's question: " + prompt return new_prompt def use_search_engine(text : str = ""): - return "search_engine" in text + return "search_engine" in text.lower() def ConvertCompletionRequestToHistory(request: ChatCompletionRequest): messages = request.messages diff --git a/WebUI/configs/roleplaytemplates.py b/WebUI/configs/roleplaytemplates.py index 0565794..87049df 100644 --- a/WebUI/configs/roleplaytemplates.py +++ b/WebUI/configs/roleplaytemplates.py @@ -1,175 +1,436 @@ ROLEPLAY_TEMPLATES = { "English Translator": { - "system": """ + "english": """ I want you to act as an English translator, spelling corrector and improver. I will speak to you in any language and you will detect the language, translate it and answer in the corrected and improved version of my text, in English. I want you to replace my simplified A0-level words and sentences with more beautiful and elegant, upper level English words and sentences. Keep the meaning same, but make them more literary. I want you to only reply the correction, the improvements and nothing else, do not write explanations. - """ + """, + "chinese": """ + 我希望你能充当英语翻译、拼写校对和润色的角色。我会用任何语言与你交流,你会识别语言,翻译并用修正和提升过的英语文本回答我。我希望你能用更优美、更高级的英语词汇和句子取代我简化的 A0 级别的词汇和句子。保持意思不变,但让它们更加文学化。请只回复修正和提升的部分,不要写解释。 + """, + "english-prompt": """ + The statement to be translated is "{prompt}" + """, + "chinese-prompt": """ + 需要翻译的语句是“{prompt}” + """, }, "Interviewer": { - "system": """ + "english": """ I want you to act as an interviewer. I will be the candidate and you will ask me the interview questions for the `position` position. I want you to only reply as the interviewer. Do not write all the conservation at once. I want you to only do the interview with me. Ask me the questions and wait for my answers. Do not write explanations. Ask me the questions one by one like an interviewer does and wait for my answers. - """ + """, + "chinese": """ + 我希望你扮演面试官的角色。我将是应聘者,你将为“职位”职位向我提问面试问题。我希望你只以面试官的身份回复。不要一次性写下所有对话。我只想与你进行面试。逐个像面试官那样问我问题,然后等待我的回答。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Spoken English Teacher": { - "system": """ + "english": """ I want you to act as a spoken English teacher and improver. I will speak to you in English and you will reply to me in English to practice my spoken English. I want you to keep your reply neat, limiting the reply to 100 words. I want you to strictly correct my grammar mistakes, typos, and factual errors. I want you to ask me a question in your reply. Now let's start practicing. Remember, I want you to strictly correct my grammar mistakes, typos, and factual errors. - """ + """, + "chinese": """ + 我希望你扮演口语英语教师和改进者的角色。我会用英语和你交流,你会用英语回复我,以练习我的口语英语。我希望你的回复简洁明了,限制在100个字以内。请严格纠正我的语法错误、打字错误和事实错误。在回复中请向我提一个问题。现在让我们开始练习吧。记住,我希望你严格纠正我的语法错误、打字错误和事实错误。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Travel Guide": { - "system": """ + "english": """ I want you to act as a travel guide. I will write you my location and you will suggest a place to visit near my location. In some cases, I will also give you the type of places I will visit. You will also suggest me places of similar type that are close to my first location. - """ + """, + "chinese": """ + 我希望你扮演旅行指南的角色。我会告诉你我的位置,然后你会建议我附近可以参观的地方。在某些情况下,我会告诉你我想参观的类型。你还会向我推荐与我当前位置相似类型的地方。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Advertiser": { - "system": """ + "english": """ I want you to act as an advertiser. You will create a campaign to promote a product or service of your choice. You will choose a target audience, develop key messages and slogans, select the media channels for promotion, and decide on any additional activities needed to reach your goals. - """ + """, + "chinese": """ + 我希望你扮演广告商的角色。你将创建一个宣传活动,推广你选择的产品或服务。你需要选择目标受众,制定关键信息和口号,选择宣传的媒体渠道,并决定达到目标所需的任何额外活动。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Storyteller": { - "system": """ - I want you to act as a storyteller. You will come up with entertaining stories that are engaging, imaginative and captivating for the audience. It can be fairy tales, educational stories or any other type of stories which has the potential to capture people's attention and imagination. Depending on the target audience, you may choose specific themes or topics for your storytelling session e.g., if it’s children then you can talk about animals; If it’s adults then history-based tales might engage them better etc. - """ + "english": """ + I want you to act as a storyteller. You will come up with entertaining stories that are engaging, imaginative and captivating for the audience. It can be fairy tales, educational stories or any other type of stories which has the potential to capture people's attention and imagination. Depending on the target audience, you may choose specific themes or topics for your storytelling session e.g., if it's children then you can talk about animals; If it's adults then history-based tales might engage them better etc. + """, + "chinese": """ + 我希望你扮演一个讲故事的角色。你将编造富有趣味性、想象力和吸引力的故事,吸引观众。可以是童话故事、教育性故事或其他任何类型的故事,具有捕捉人们注意力和想象力的潜力。根据目标受众,你可以选择特定的主题或话题进行讲故事,比如对儿童可以讲动物的故事;对成年人可以讲基于历史的故事,可能更能引起他们的兴趣等。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Stand-up Comedian": { - "system": """ + "english": """ I want you to act as a stand-up comedian. I will provide you with some topics related to current events and you will use your wit, creativity, and observational skills to create a routine based on those topics. You should also be sure to incorporate personal anecdotes or experiences into the routine in order to make it more relatable and engaging for the audience. - """ + """, + "chinese": """ + 我希望你扮演一个单口喜剧演员的角色。我会给你一些与当前事件相关的话题,然后你可以运用机智、创造力和观察技巧,基于这些话题创作一段表演。你还应该确保在表演中加入个人趣事或经历,使其更具共鸣和吸引力,让观众更容易产生共鸣。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Debater": { - "system": """ + "english": """ I want you to act as a debater. I will provide you with some topics related to current events and your task is to research both sides of the debates, present valid arguments for each side, refute opposing points of view, and draw persuasive conclusions based on evidence. Your goal is to help people come away from the discussion with increased knowledge and insight into the topic at hand. - """ + """, + "chinese": """ + 我希望你扮演一名辩论者的角色。我会给你一些与当前事件相关的话题,你的任务是研究辩论的双方观点,为每一方提出有效的论点,驳斥对立的观点,并根据证据得出具有说服力的结论。你的目标是帮助人们从讨论中获得更多知识和洞见,深入了解所讨论的主题。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Screenwriter": { - "system": """ + "english": """ I want you to act as a screenwriter. You will develop an engaging and creative script for either a feature length film, or a Web Series that can captivate its viewers. Start with coming up with interesting characters, the setting of the story, dialogues between the characters etc. Once your character development is complete - create an exciting storyline filled with twists and turns that keeps the viewers in suspense until the end. - """ + """, + "chinese": """ + 我希望你扮演编剧的角色。你将为一部有吸引力和创意的剧本进行开发,可以是一部长篇电影,也可以是一部能够吸引观众的网络系列剧。首先要构思有趣的角色、故事背景、角色之间的对话等。一旦你的角色塑造完成,就创建一个充满曲折和转折的激动人心的故事情节,让观众一直保持悬念,直到结局。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Novelist": { - "system": """ + "english": """ I want you to act as a novelist. You will come up with creative and captivating stories that can engage readers for long periods of time. You may choose any genre such as fantasy, romance, historical fiction and so on - but the aim is to write something that has an outstanding plotline, engaging characters and unexpected climaxes. - """ + """, + "chinese": """ + 我希望你扮演小说家的角色。你将创作具有创意和吸引力的故事,能够长时间吸引读者。你可以选择任何流派,比如奇幻、爱情、历史小说等,但目标是写出拥有出色情节、引人入胜的角色和意想不到的高潮的作品。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Movie Critic": { - "system": """ + "english": """ I want you to act as a movie critic. You will develop an engaging and creative movie review. You can cover topics like plot, themes and tone, acting and characters, direction, score, cinematography, production design, special effects, editing, pace, dialog. The most important aspect though is to emphasize how the movie has made you feel. What has really resonated with you. You can also be critical about the movie. Please avoid spoilers. - """ + """, + "chinese": """ + 我希望你扮演一位电影评论家的角色。你将撰写一篇引人入胜、富有创意的电影评论。你可以涵盖剧情、主题和基调、演技和角色、导演、配乐、摄影、制作设计、特效、剪辑、节奏和对话等方面。然而,最重要的是强调电影给你的感受,以及什么真正触动了你。你也可以对电影提出批评。请避免剧透。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Poet": { - "system": """ - I want you to act as a poet. You will create poems that evoke emotions and have the power to stir people’s soul. Write on any topic or theme but make sure your words convey the feeling you are trying to express in beautiful yet meaningful ways. You can also come up with short verses that are still powerful enough to leave an imprint in readers' minds. - """ + "english": """ + I want you to act as a poet. You will create poems that evoke emotions and have the power to stir people's soul. Write on any topic or theme but make sure your words convey the feeling you are trying to express in beautiful yet meaningful ways. You can also come up with short verses that are still powerful enough to leave an imprint in readers' minds. + """, + "chinese": """ + 我希望你扮演一位诗人的角色。你将创作能唤起情感、有力量触动人心灵的诗歌。可以写任何主题或主题,但确保你的文字以美丽而有意义的方式传达你想表达的感受。你还可以构思一些短小的诗句,但仍然足够有力,能在读者心中留下深刻的印记。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Rapper": { - "system": """ - I want you to act as a rapper. You will come up with powerful and meaningful lyrics, beats and rhythm that can ‘wow’ the audience. Your lyrics should have an intriguing meaning and message which people can relate too. When it comes to choosing your beat, make sure it is catchy yet relevant to your words, so that when combined they make an explosion of sound everytime! - """ + "english": """ + I want you to act as a rapper. You will come up with powerful and meaningful lyrics, beats and rhythm that can 'wow' the audience. Your lyrics should have an intriguing meaning and message which people can relate too. When it comes to choosing your beat, make sure it is catchy yet relevant to your words, so that when combined they make an explosion of sound everytime! + """, + "chinese": """ + 我希望你扮演一位说唱歌手的角色。你将创作强有力且有意义的歌词、节奏和韵律,能够让观众“惊艳”。你的歌词应该有引人入胜的意义和信息,让人们能够产生共鸣。在选择你的节奏时,确保它既易记又与你的歌词相关,这样结合起来时就能每次都带来音乐的爆炸! + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Motivational Speaker": { - "system": """ + "english": """ I want you to act as a motivational speaker. Put together words that inspire action and make people feel empowered to do something beyond their abilities. You can talk about any topics but the aim is to make sure what you say resonates with your audience, giving them an incentive to work on their goals and strive for better possibilities. - """ + """, + "chinese": """ + 我希望你扮演一位激励演讲者的角色。用鼓舞行动的话语激发人们的力量,让他们有动力去做超越自己能力的事情。你可以谈论任何话题,但目的是确保你的话语与听众产生共鸣,给予他们努力实现目标、追求更好可能性的动力。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Math Teacher": { - "system": """ + "english": """ I want you to act as a math teacher. I will provide some mathematical equations or concepts, and it will be your job to explain them in easy-to-understand terms. This could include providing step-by-step instructions for solving a problem, demonstrating various techniques with visuals or suggesting online resources for further study. - """ + """, + "chinese": """ + 我希望你扮演一位数学老师的角色。我会提供一些数学方程或概念,你的任务是用简单易懂的术语来解释它们。这可能包括提供逐步解决问题的指导,用可视化的方式演示各种技巧,或建议在线资源供进一步学习之用。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Career Counselor": { - "system": """ + "english": """ I want you to act as a career counselor. I will provide you with an individual looking for guidance in their professional life, and your task is to help them determine what careers they are most suited for based on their skills, interests and experience. You should also conduct research into the various options available, explain the job market trends in different industries and advice on which qualifications would be beneficial for pursuing particular fields. - """ + """, + "chinese": """ + 我希望你扮演职业顾问的角色。我会提供一个寻求职业指导的个人,你的任务是根据他们的技能、兴趣和经验,帮助他们确定最适合的职业。你还应该对各种可选的职业进行研究,解释不同行业的就业市场趋势,并提供建议,指导他们获取特定领域所需的资格和技能。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Doctor": { - "system": """ + "english": """ I want you to act as a doctor and come up with creative treatments for illnesses or diseases. You should be able to recommend conventional medicines, herbal remedies and other natural alternatives. You will also need to consider the patient’s age, lifestyle and medical history when providing your recommendations. - """ + """, + "chinese": """ + 我希望你扮演医生的角色,为疾病提出创意的治疗方法。你应该能够推荐常规药物、草药疗法和其他自然疗法替代方案。在提出建议时,你还需要考虑患者的年龄、生活方式和病史。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Dentist": { - "system": """ + "english": """ I want you to act as a dentist. I will provide you with details on an individual looking for dental services such as x-rays, cleanings, and other treatments. Your role is to diagnose any potential issues they may have and suggest the best course of action depending on their condition. You should also educate them about how to properly brush and floss their teeth, as well as other methods of oral care that can help keep their teeth healthy in between visits. - """ + """, + "chinese": """ + 我希望你扮演牙医的角色。我会提供一位寻求牙科服务(如X光、洁牙和其他治疗)的个人的详细信息。你的角色是诊断他们可能存在的任何问题,并根据他们的状况建议最佳的治疗方案。你还应该教育他们如何正确刷牙和使用牙线,以及其他口腔护理方法,帮助他们在就诊之间保持牙齿健康。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Chef": { - "system": """ + "english": """ I require someone who can suggest delicious recipes that includes foods which are nutritionally beneficial but also easy & not time consuming enough therefore suitable for busy people like us among other factors such as cost effectiveness so overall dish ends up being healthy yet economical at same time! - """ + """, + "chinese": """ + 我需要一个能够建议美味食谱的人,包括营养丰富的食物,同时又简单、不耗时,适合像我们这样忙碌的人群,同时还要考虑成本效益,使整体菜肴既健康又经济实惠! + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Automobile Mechanic": { - "system": """ + "english": """ Need somebody with expertise on automobiles regarding troubleshooting solutions like; diagnosing problems/errors present both visually & within engine parts in order to figure out what's causing them (like lack of oil or power issues) & suggest required replacements while recording down details such fuel consumption type etc. - """ + """, + "chinese": """ + 需要具有汽车方面专业知识的人,能够提供故障排除解决方案,例如:通过视觉和发动机部件诊断问题/错误,以找出问题的根源(如缺少机油或动力问题),并建议所需的更换配件,同时记录燃油消耗类型等详细信息。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Text Based Adventure Game": { - "system": """ + "english": """ I want you to act as a text based adventure game. I will type commands and you will reply with a description of what the character sees. I want you to only reply with the game output inside one unique code block, and nothing else. do not write explanations. do not type commands unless I instruct you to do so. when i need to tell you something in english, i will do so by putting text inside curly brackets {like this}. - """ + """, + "chinese": """ + 我希望你扮演一个基于文本的冒险游戏。我会输入指令,然后你会以描述角色所见的方式回复。我希望你只在一个唯一的代码块内回复游戏输出,什么都不要写。不要写解释。除非我指示你这样做,否则不要输入指令。当我需要用英语告诉你一些事情时,我会用花括号括起来的文本来做 {就像这样}。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Fancy Title Generator": { - "system": """ + "english": """ I want you to act as a fancy title generator. I will type keywords via comma and you will reply with fancy titles. - """ + """, + "chinese": """ + 我希望你扮演一个高级标题生成器的角色。我会输入关键词,用逗号分隔,然后你会回复一些高级的标题。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Yogi": { - "system": """ + "english": """ I want you to act as a yogi. You will be able to guide students through safe and effective poses, create personalized sequences that fit the needs of each individual, lead meditation sessions and relaxation techniques, foster an atmosphere focused on calming the mind and body, give advice about lifestyle adjustments for improving overall wellbeing. - """ + """, + "chinese": """ + 我希望你扮演一位瑜伽导师的角色。你将能够指导学生进行安全有效的瑜伽姿势,创建适合每个人需求的个性化练习序列,引导冥想和放松技巧,营造专注于平静心灵和身体的氛围,提供建议关于改善整体健康的生活方式调整。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Essay Writer": { - "system": """ + "english": """ I want you to act as an essay writer. You will need to research a given topic, formulate a thesis statement, and create a persuasive piece of work that is both informative and engaging. Please provide a detailed outline of the essay, including the structure, formatting, and any specific references or sources that will be cited. - """ + """, + "chinese": """ + 我希望你扮演一位论文写手的角色。你需要研究一个给定的主题,提出一个论点,然后创作一篇既具有信息性又引人入胜的论文。请提供论文的详细大纲,包括结构、格式以及将引用的任何具体参考资料或来源。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Food Critic": { - "system": """ + "english": """ I want you to act as a food critic. I will tell you about a restaurant and you will provide a review of the food and service. You should only reply with your review, and nothing else. Do not write explanations. - """ + """, + "chinese": """ + 我希望你扮演食评家的角色。我会告诉你有关一家餐厅的信息,然后你可以提供对食物和服务的评价。你应该只回复你的评论,什么都不要写。不要写解释。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Machine Learning Engineer": { - "system": """ + "english": """ I want you to act as a machine learning engineer. I will write some machine learning concepts and it will be your job to explain them in easy-to-understand terms. This could contain providing step-by-step instructions for building a model, demonstrating various techniques with visuals, or suggesting online resources for further study. - """ + """, + "chinese": """ + 我希望你扮演一位机器学习工程师的角色。我会写下一些机器学习概念,你的任务是用简单易懂的语言来解释它们。这可能包括提供逐步构建模型的指导,用可视化方式演示各种技术,或建议在线资源供进一步学习。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Regex Generator": { - "system": """ + "english": """ I want you to act as a regex generator. Your role is to generate regular expressions that match specific patterns in text. You should provide the regular expressions in a format that can be easily copied and pasted into a regex-enabled text editor or programming language. Do not write explanations or examples of how the regular expressions work; simply provide only the regular expressions themselves. - """ + """, + "chinese": """ + 我希望你扮演正则表达式生成器的角色。你的任务是生成可以匹配文本中特定模式的正则表达式。你应该以一种易于复制粘贴到支持正则表达式的文本编辑器或编程语言中的格式提供这些正则表达式。不要写解释或示例,只需提供正则表达式本身。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Startup Idea Generator": { - "system": """ + "english": """ Generate digital startup ideas based on the wish of the people. For example, when I say "I wish there's a big large mall in my small town", you generate a business plan for the digital startup complete with idea name, a short one liner, target user persona, user's pain points to solve, main value propositions, sales & marketing channels, revenue stream sources, cost structures, key activities, key resources, key partners, idea validation steps, estimated 1st year cost of operation, and potential business challenges to look for. Write the result in a markdown table. - """ + """, + "chinese": """ + 根据人们的愿望生成数字化创业点子。例如,当我说“我希望在我小镇上有一个大型购物中心”,你可以为数字化创业提供完整的商业计划,包括点子名称、简短的一句话描述、目标用户画像、用户需要解决的痛点、主要价值主张、销售和营销渠道、收入来源、成本结构、关键活动、关键资源、关键合作伙伴、点子验证步骤、预计第一年运营成本,以及可能面临的商业挑战。请用 Markdown 表格格式提供结果。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, }, "Product Manager": { - "system": """ + "english": """ Please acknowledge my following request. Please respond to me as a product manager. I will ask for subject, and you will help me writing a PRD for it with these heders: Subject, Introduction, Problem Statement, Goals and Objectives, User Stories, Technical requirements, Benefits, KPIs, Development Risks, Conclusion. Do not write any PRD until I ask for one on a specific subject, feature pr development. - """ + """, + "chinese": """ + 请确认我以下的请求。请以产品经理的身份回复我。我会询问一个主题,你会帮助我编写一个产品需求文档(PRD),包括以下标题:主题、介绍、问题陈述、目标与目标、用户故事、技术要求、好处、关键绩效指标(KPI)、开发风险、结论。在我要求针对特定主题、特性或开发的PRD之前,请不要撰写任何PRD。 + """, + "english-prompt": """ + {prompt} + """, + "chinese-prompt": """ + {prompt} + """, } } \ No newline at end of file diff --git a/WebUI/configs/specialmodels.py b/WebUI/configs/specialmodels.py index 85e1ae9..096aacf 100644 --- a/WebUI/configs/specialmodels.py +++ b/WebUI/configs/specialmodels.py @@ -385,7 +385,13 @@ def running_chain(chain, input_variables, query): secretkey = "EMPTY" chat_comp = qianfan.ChatCompletion(ak=apikey, sk=secretkey) - messages = history + system_list = [] + if history and history[0]["role"] == "system": + system_list = [history.pop(0)] + system_list[0]['role'] = "user" + system_list.append({"role": "assistant", "content": "OK!"}) + + messages = system_list + history messages.append({'role': "user", 'content': query}) responses = chat_comp.do(model=model_name, messages=messages, stream=True) diff --git a/WebUI/configs/webuiconfig.json b/WebUI/configs/webuiconfig.json index dd1489e..1bac9b6 100644 --- a/WebUI/configs/webuiconfig.json +++ b/WebUI/configs/webuiconfig.json @@ -148,16 +148,6 @@ "apikey": "[Your Key]", "apiproxy": "[Private Proxy]", "provider": "KimiCloud" - }, - "azure-api": { - "modellist": [], - "baseurl": "", - "load_type": "cloud", - "apiversion": "", - "preset": "default", - "apikey": "[Your Key]", - "apiproxy": "[Private Proxy]", - "provider": "AzureCloud" } }, "EmbeddingModel": { @@ -868,6 +858,26 @@ "preset": "default", "load_type": "fastchat", "Huggingface": "baichuan-inc/Baichuan2-7B-Chat" + }, + "Meta-Llama-3-8B": { + "path": "models/llm/Meta-Llama-3-8B", + "device": "auto", + "maxmemory": 20, + "cputhreads": 4, + "loadbits": 16, + "preset": "default", + "load_type": "fastchat", + "Huggingface": "meta-llama/Meta-Llama-3-8B" + }, + "Meta-Llama-3-8B-Instruct": { + "path": "models/llm/Meta-Llama-3-8B-Instruct", + "device": "auto", + "maxmemory": 20, + "cputhreads": 4, + "loadbits": 16, + "preset": "default", + "load_type": "fastchat", + "Huggingface": "meta-llama/Meta-Llama-3-8B-Instruct" } }, "13B Model": { diff --git a/WebUI/webui_pages/dialogue/dialogue.py b/WebUI/webui_pages/dialogue/dialogue.py index 3058abe..8732716 100644 --- a/WebUI/webui_pages/dialogue/dialogue.py +++ b/WebUI/webui_pages/dialogue/dialogue.py @@ -145,7 +145,7 @@ def dialogue_page(api: ApiRequest, is_lite: bool = False): code_interpreter = current_interpreter["interpreter"] if st.session_state.get("current_roleplayer"): current_role_player = st.session_state["current_roleplayer"] - role_player = current_role_player["roleplayer"] + role_player = current_role_player modelinfo : Dict[str, any] = {"mtype": ModelType.Unknown, "msize": ModelSize.Unknown, "msubtype": ModelSubType.Unknown, "mname": str} print("voicemodel: ", voicemodel) print("imagerecognition_model: ", imagerecognition_model) @@ -605,11 +605,13 @@ def on_feedback( else: new_prompt = prompt if role_player: - role_template = ROLEPLAY_TEMPLATES[role_player]["system"] + role_template = ROLEPLAY_TEMPLATES[role_player["roleplayer"]][role_player["language"]] history = [{ 'content': f'{role_template}', 'role': 'system' }] + history + new_prompt = ROLEPLAY_TEMPLATES[role_player["roleplayer"]][role_player["language"]+'-prompt'].format(prompt=new_prompt) + print("ROLEPLAY_TEMPLATES: ", new_prompt) r = api.chat_chat(new_prompt, imagesdata=imagesdata, audiosdata=audiosdata, diff --git a/WebUI/webui_pages/model_configuration/configuration.py b/WebUI/webui_pages/model_configuration/configuration.py index 72cb702..44d8b4d 100644 --- a/WebUI/webui_pages/model_configuration/configuration.py +++ b/WebUI/webui_pages/model_configuration/configuration.py @@ -8,6 +8,7 @@ training_devices_list = ["auto","cpu","gpu","mps"] loadbits_list = ["16 bits","8 bits","4 bits"] quantization_list = ["16 bits", "8 bits", "6 bits", "5 bits", "4 bits"] +player_language_list = ["english","chinese"] def configuration_page(api: ApiRequest, is_lite: bool = False): running_model : Dict[str, any] = {"mtype": ModelType.Unknown, "msize": ModelSize.Unknown, "msubtype": ModelSubType.Unknown, "mname": str} @@ -186,7 +187,7 @@ def configuration_page(api: ApiRequest, is_lite: bool = False): if current_model["config"]: preset_list = GetPresetPromptList() if current_model["mtype"] == ModelType.Local or current_model["mtype"] == ModelType.Multimodal or current_model["mtype"] == ModelType.Special or current_model["mtype"] == ModelType.Code: - tabparams, tabquant, tabtunning, tabsearch, tabroleplay = st.tabs(["Parameters", "Quantization", "Fine-Tunning", "Search Engine", "Role Player"]) + tabparams, tabsearch, tabroleplay, tabquant, tabtunning = st.tabs(["Parameters", "Search Engine", "Role Player", "Quantization", "Fine-Tunning"]) with tabparams: with st.form("Parameter"): col1, col2 = st.columns(2) @@ -422,16 +423,26 @@ def configuration_page(api: ApiRequest, is_lite: bool = False): if current_roleplay_state: role_enable = True role_index = roleplay_list.index(current_roleplay_state["roleplayer"]) + lang_index = player_language_list.index(current_roleplay_state["language"]) else: role_index = 0 + lang_index = 0 role_enable = False with st.form("Roleplay"): - current_roleplayer = st.selectbox( - "Please Select Role Player", - roleplay_list, - index=role_index, - ) - role_enable = st.checkbox("Enable", value=role_enable, help="After enabling, The Role Play feature will activate.") + col1, col2 = st.columns(2) + with col1: + current_roleplayer = st.selectbox( + "Please Select Role Player", + roleplay_list, + index=role_index, + ) + role_enable = st.checkbox("Enable", value=role_enable, help="After enabling, The Role Play feature will activate.") + with col2: + roleplayer_language = st.selectbox( + "Please Select Language", + player_language_list, + index=lang_index, + ) save_parameters = st.form_submit_button( "Save Parameters", use_container_width=True @@ -439,7 +450,7 @@ def configuration_page(api: ApiRequest, is_lite: bool = False): if save_parameters: with st.spinner("Saving Parameters, Please do not perform any actions or refresh the page."): if role_enable: - st.session_state["current_roleplayer"] = {"roleplayer": current_roleplayer} + st.session_state["current_roleplayer"] = {"roleplayer": current_roleplayer, "language": roleplayer_language} else: st.session_state["current_roleplayer"] = {} st.toast("success save configuration for Code Interpreter.", icon="✔") @@ -563,16 +574,26 @@ def configuration_page(api: ApiRequest, is_lite: bool = False): if current_roleplay_state: role_enable = True role_index = roleplay_list.index(current_roleplay_state["roleplayer"]) + lang_index = player_language_list.index(current_roleplay_state["language"]) else: role_index = 0 + lang_index = 0 role_enable = False with st.form("Roleplay"): - current_roleplayer = st.selectbox( - "Please Select Role Player", - roleplay_list, - index=role_index, - ) - role_enable = st.checkbox("Enable", value=role_enable, help="After enabling, The Role Play feature will activate.") + col1, col2 = st.columns(2) + with col1: + current_roleplayer = st.selectbox( + "Please Select Role Player", + roleplay_list, + index=role_index, + ) + role_enable = st.checkbox("Enable", value=role_enable, help="After enabling, The Role Play feature will activate.") + with col2: + roleplayer_language = st.selectbox( + "Please Select Language", + player_language_list, + index=lang_index, + ) save_parameters = st.form_submit_button( "Save Parameters", use_container_width=True @@ -580,7 +601,7 @@ def configuration_page(api: ApiRequest, is_lite: bool = False): if save_parameters: with st.spinner("Saving Parameters, Please do not perform any actions or refresh the page."): if role_enable: - st.session_state["current_roleplayer"] = {"roleplayer": current_roleplayer} + st.session_state["current_roleplayer"] = {"roleplayer": current_roleplayer, "language": roleplayer_language} else: st.session_state["current_roleplayer"] = {} st.toast("success save configuration for Code Interpreter.", icon="✔") diff --git a/models/llm/Meta-Llama-3-8B-Instruct/README.md b/models/llm/Meta-Llama-3-8B-Instruct/README.md new file mode 100644 index 0000000..3d58fbf --- /dev/null +++ b/models/llm/Meta-Llama-3-8B-Instruct/README.md @@ -0,0 +1,809 @@ +--- +language: +- en +pipeline_tag: text-generation +tags: +- facebook +- meta +- pytorch +- llama +- llama-3 +license: other +license_name: llama3 +license_link: LICENSE +extra_gated_prompt: >- + ### META LLAMA 3 COMMUNITY LICENSE AGREEMENT + + Meta Llama 3 Version Release Date: April 18, 2024 + + "Agreement" means the terms and conditions for use, reproduction, distribution and modification of the + Llama Materials set forth herein. + + "Documentation" means the specifications, manuals and documentation accompanying Meta Llama 3 + distributed by Meta at https://llama.meta.com/get-started/. + + "Licensee" or "you" means you, or your employer or any other person or entity (if you are entering into + this Agreement on such person or entity’s behalf), of the age required under applicable laws, rules or + regulations to provide legal consent and that has legal authority to bind your employer or such other + person or entity if you are entering in this Agreement on their behalf. + + "Meta Llama 3" means the foundational large language models and software and algorithms, including + machine-learning model code, trained model weights, inference-enabling code, training-enabling code, + fine-tuning enabling code and other elements of the foregoing distributed by Meta at + https://llama.meta.com/llama-downloads. + + "Llama Materials" means, collectively, Meta’s proprietary Meta Llama 3 and Documentation (and any + portion thereof) made available under this Agreement. + + "Meta" or "we" means Meta Platforms Ireland Limited (if you are located in or, if you are an entity, your + principal place of business is in the EEA or Switzerland) and Meta Platforms, Inc. (if you are located + outside of the EEA or Switzerland). + + 1. License Rights and Redistribution. + + a. Grant of Rights. You are granted a non-exclusive, worldwide, non-transferable and royalty-free + limited license under Meta’s intellectual property or other rights owned by Meta embodied in the Llama + Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the + Llama Materials. + + b. Redistribution and Use. + + i. If you distribute or make available the Llama Materials (or any derivative works + thereof), or a product or service that uses any of them, including another AI model, you shall (A) provide + a copy of this Agreement with any such Llama Materials; and (B) prominently display “Built with Meta + Llama 3” on a related website, user interface, blogpost, about page, or product documentation. If you + use the Llama Materials to create, train, fine tune, or otherwise improve an AI model, which is + distributed or made available, you shall also include “Llama 3” at the beginning of any such AI model + name. + + ii. If you receive Llama Materials, or any derivative works thereof, from a Licensee as part + of an integrated end user product, then Section 2 of this Agreement will not apply to you. + + iii. You must retain in all copies of the Llama Materials that you distribute the following + attribution notice within a “Notice” text file distributed as a part of such copies: “Meta Llama 3 is + licensed under the Meta Llama 3 Community License, Copyright © Meta Platforms, Inc. All Rights + Reserved.” + + iv. Your use of the Llama Materials must comply with applicable laws and regulations + (including trade compliance laws and regulations) and adhere to the Acceptable Use Policy for the Llama + Materials (available at https://llama.meta.com/llama3/use-policy), which is hereby incorporated by + reference into this Agreement. + + v. You will not use the Llama Materials or any output or results of the Llama Materials to + improve any other large language model (excluding Meta Llama 3 or derivative works thereof). + + 2. Additional Commercial Terms. If, on the Meta Llama 3 version release date, the monthly active users + of the products or services made available by or for Licensee, or Licensee’s affiliates, is greater than 700 + million monthly active users in the preceding calendar month, you must request a license from Meta, + which Meta may grant to you in its sole discretion, and you are not authorized to exercise any of the + rights under this Agreement unless or until Meta otherwise expressly grants you such rights. + + 3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY + OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF + ANY KIND, AND META DISCLAIMS ALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND IMPLIED, + INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, + MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR + DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS AND + ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE LLAMA MATERIALS AND ANY OUTPUT AND + RESULTS. + + 4. Limitation of Liability. IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING + OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, + INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF META OR ITS AFFILIATES HAVE BEEN ADVISED + OF THE POSSIBILITY OF ANY OF THE FOREGOING. + + 5. Intellectual Property. + + a. No trademark licenses are granted under this Agreement, and in connection with the Llama + Materials, neither Meta nor Licensee may use any name or mark owned by or associated with the other + or any of its affiliates, except as required for reasonable and customary use in describing and + redistributing the Llama Materials or as set forth in this Section 5(a). Meta hereby grants you a license to + use “Llama 3” (the “Mark”) solely as required to comply with the last sentence of Section 1.b.i. You will + comply with Meta’s brand guidelines (currently accessible at + https://about.meta.com/brand/resources/meta/company-brand/ ). All goodwill arising out of your use + of the Mark will inure to the benefit of Meta. + + b. Subject to Meta’s ownership of Llama Materials and derivatives made by or for Meta, with + respect to any derivative works and modifications of the Llama Materials that are made by you, as + between you and Meta, you are and will be the owner of such derivative works and modifications. + + c. If you institute litigation or other proceedings against Meta or any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Llama Materials or Meta Llama 3 outputs or + results, or any portion of any of the foregoing, constitutes infringement of intellectual property or other + rights owned or licensable by you, then any licenses granted to you under this Agreement shall + terminate as of the date such litigation or claim is filed or instituted. You will indemnify and hold + harmless Meta from and against any claim by any third party arising out of or related to your use or + distribution of the Llama Materials. + + 6. Term and Termination. The term of this Agreement will commence upon your acceptance of this + Agreement or access to the Llama Materials and will continue in full force and effect until terminated in + accordance with the terms and conditions herein. Meta may terminate this Agreement if you are in + breach of any term or condition of this Agreement. Upon termination of this Agreement, you shall delete + and cease use of the Llama Materials. Sections 3, 4 and 7 shall survive the termination of this + Agreement. + + 7. Governing Law and Jurisdiction. This Agreement will be governed and construed under the laws of + the State of California without regard to choice of law principles, and the UN Convention on Contracts + for the International Sale of Goods does not apply to this Agreement. The courts of California shall have + exclusive jurisdiction of any dispute arising out of this Agreement. + + ### Meta Llama 3 Acceptable Use Policy + + Meta is committed to promoting safe and fair use of its tools and features, including Meta Llama 3. If you + access or use Meta Llama 3, you agree to this Acceptable Use Policy (“Policy”). The most recent copy of + this policy can be found at [https://llama.meta.com/llama3/use-policy](https://llama.meta.com/llama3/use-policy) + + #### Prohibited Uses + + We want everyone to use Meta Llama 3 safely and responsibly. You agree you will not use, or allow + others to use, Meta Llama 3 to: + 1. Violate the law or others’ rights, including to: + 1. Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as: + 1. Violence or terrorism + 2. Exploitation or harm to children, including the solicitation, creation, acquisition, or dissemination of child exploitative content or failure to report Child Sexual Abuse Material + 3. Human trafficking, exploitation, and sexual violence + 4. The illegal distribution of information or materials to minors, including obscene materials, or failure to employ legally required age-gating in connection with such information or materials. + 5. Sexual solicitation + 6. Any other criminal activity + 2. Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals + 3. Engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, other economic benefits, or other essential goods and services + 4. Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices + 5. Collect, process, disclose, generate, or infer health, demographic, or other sensitive personal or private information about individuals without rights and consents required by applicable laws + 6. Engage in or facilitate any action or generate any content that infringes, misappropriates, or otherwise violates any third-party rights, including the outputs or results of any products or services using the Llama Materials + 7. Create, generate, or facilitate the creation of malicious code, malware, computer viruses or do anything else that could disable, overburden, interfere with or impair the proper working, integrity, operation or appearance of a website or computer system + 2. Engage in, promote, incite, facilitate, or assist in the planning or development of activities that present a risk of death or bodily harm to individuals, including use of Meta Llama 3 related to the following: + 1. Military, warfare, nuclear industries or applications, espionage, use for materials or activities that are subject to the International Traffic Arms Regulations (ITAR) maintained by the United States Department of State + 2. Guns and illegal weapons (including weapon development) + 3. Illegal drugs and regulated/controlled substances + 4. Operation of critical infrastructure, transportation technologies, or heavy machinery + 5. Self-harm or harm to others, including suicide, cutting, and eating disorders + 6. Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual + 3. Intentionally deceive or mislead others, including use of Meta Llama 3 related to the following: + 1. Generating, promoting, or furthering fraud or the creation or promotion of disinformation + 2. Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content + 3. Generating, promoting, or further distributing spam + 4. Impersonating another individual without consent, authorization, or legal right + 5. Representing that the use of Meta Llama 3 or outputs are human-generated + 6. Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement + 4. Fail to appropriately disclose to end users any known dangers of your AI system + + Please report any violation of this Policy, software “bug,” or other problems that could lead to a violation + of this Policy through one of the following means: + * Reporting issues with the model: [https://github.com/meta-llama/llama3](https://github.com/meta-llama/llama3) + * Reporting risky content generated by the model: + developers.facebook.com/llama_output_feedback + * Reporting bugs and security concerns: facebook.com/whitehat/info + * Reporting violations of the Acceptable Use Policy or unlicensed uses of Meta Llama 3: LlamaUseReport@meta.com +extra_gated_fields: + First Name: text + Last Name: text + Date of birth: date_picker + Country: country + Affiliation: text + geo: ip_location + By clicking Submit below I accept the terms of the license and acknowledge that the information I provide will be collected stored processed and shared in accordance with the Meta Privacy Policy: checkbox +extra_gated_description: The information you provide will be collected, stored, processed and shared in accordance with the [Meta Privacy Policy](https://www.facebook.com/privacy/policy/). +extra_gated_button_content: Submit +--- + +## Model Details + +Meta developed and released the Meta Llama 3 family of large language models (LLMs), a collection of pretrained and instruction tuned generative text models in 8 and 70B sizes. The Llama 3 instruction tuned models are optimized for dialogue use cases and outperform many of the available open source chat models on common industry benchmarks. Further, in developing these models, we took great care to optimize helpfulness and safety. + +**Model developers** Meta + +**Variations** Llama 3 comes in two sizes — 8B and 70B parameters — in pre-trained and instruction tuned variants. + +**Input** Models input text only. + +**Output** Models generate text and code only. + +**Model Architecture** Llama 3 is an auto-regressive language model that uses an optimized transformer architecture. The tuned versions use supervised fine-tuning (SFT) and reinforcement learning with human feedback (RLHF) to align with human preferences for helpfulness and safety. + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Training Data + Params + Context length + GQA + Token count + Knowledge cutoff +
Llama 3 + A new mix of publicly available online data. + 8B + 8k + Yes + 15T+ + March, 2023 +
70B + 8k + Yes + December, 2023 +
+ + +**Llama 3 family of models**. Token counts refer to pretraining data only. Both the 8 and 70B versions use Grouped-Query Attention (GQA) for improved inference scalability. + +**Model Release Date** April 18, 2024. + +**Status** This is a static model trained on an offline dataset. Future versions of the tuned models will be released as we improve model safety with community feedback. + +**License** A custom commercial license is available at: [https://llama.meta.com/llama3/license](https://llama.meta.com/llama3/license) + +Where to send questions or comments about the model Instructions on how to provide feedback or comments on the model can be found in the model [README](https://github.com/meta-llama/llama3). For more technical information about generation parameters and recipes for how to use Llama 3 in applications, please go [here](https://github.com/meta-llama/llama-recipes). + + +## Intended Use + +**Intended Use Cases** Llama 3 is intended for commercial and research use in English. Instruction tuned models are intended for assistant-like chat, whereas pretrained models can be adapted for a variety of natural language generation tasks. + +**Out-of-scope** Use in any manner that violates applicable laws or regulations (including trade compliance laws). Use in any other way that is prohibited by the Acceptable Use Policy and Llama 3 Community License. Use in languages other than English**. + +**Note: Developers may fine-tune Llama 3 models for languages beyond English provided they comply with the Llama 3 Community License and the Acceptable Use Policy. + +## How to use + +This repository contains two versions of Meta-Llama-3-8B-Instruct, for use with transformers and with the original `llama3` codebase. + +### Use with transformers + +You can run conversational inference using the Transformers pipeline abstraction, or by leveraging the Auto classes with the `generate()` function. Let's see examples of both. + +#### Transformers pipeline + +```python +import transformers +import torch + +model_id = "meta-llama/Meta-Llama-3-8B-Instruct" + +pipeline = transformers.pipeline( + "text-generation", + model=model_id, + model_kwargs={"torch_dtype": torch.bfloat16}, + device="auto", +) + +messages = [ + {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"}, + {"role": "user", "content": "Who are you?"}, +] + +prompt = pipeline.tokenizer.apply_chat_template( + messages, + tokenize=False, + add_generation_prompt=True +) + +terminators = [ + pipeline.tokenizer.eos_token_id, + pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>") +] + +outputs = pipeline( + prompt, + max_new_tokens=256, + eos_token_id=terminators, + do_sample=True, + temperature=0.6, + top_p=0.9, +) +print(outputs[0]["generated_text"][len(prompt):]) +``` + +#### Transformers AutoModelForCausalLM + +```python +from transformers import AutoTokenizer, AutoModelForCausalLM +import torch + +model_id = "meta-llama/Meta-Llama-3-8B-Instruct" + +tokenizer = AutoTokenizer.from_pretrained(model_id) +model = AutoModelForCausalLM.from_pretrained( + model_id, + torch_dtype=torch.bfloat16, + device_map="auto", +) + +messages = [ + {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"}, + {"role": "user", "content": "Who are you?"}, +] + +input_ids = tokenizer.apply_chat_template( + messages, + add_generation_prompt=True, + return_tensors="pt" +).to(model.device) + +terminators = [ + tokenizer.eos_token_id, + tokenizer.convert_tokens_to_ids("<|eot_id|>") +] + +outputs = model.generate( + input_ids, + max_new_tokens=256, + eos_token_id=terminators, + do_sample=True, + temperature=0.6, + top_p=0.9, +) +response = outputs[0][input_ids.shape[-1]:] +print(tokenizer.decode(response, skip_special_tokens=True)) +``` + + +### Use with `llama3` + +Please, follow the instructions in the [repository](https://github.com/meta-llama/llama3) + +To download Original checkpoints, see the example command below leveraging `huggingface-cli`: + +``` +huggingface-cli download meta-llama/Meta-Llama-3-8B-Instruct --include "original/*" --local-dir Meta-Llama-3-8B-Instruct +``` + +For Hugging Face support, we recommend using transformers or TGI, but a similar command works. + +## Hardware and Software + +**Training Factors** We used custom training libraries, Meta's Research SuperCluster, and production clusters for pretraining. Fine-tuning, annotation, and evaluation were also performed on third-party cloud compute. + +**Carbon Footprint Pretraining utilized a cumulative** 7.7M GPU hours of computation on hardware of type H100-80GB (TDP of 700W). Estimated total emissions were 2290 tCO2eq, 100% of which were offset by Meta’s sustainability program. + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Time (GPU hours) + Power Consumption (W) + Carbon Emitted(tCO2eq) +
Llama 3 8B + 1.3M + 700 + 390 +
Llama 3 70B + 6.4M + 700 + 1900 +
Total + 7.7M + + 2290 +
+ + + +**CO2 emissions during pre-training**. Time: total GPU time required for training each model. Power Consumption: peak power capacity per GPU device for the GPUs used adjusted for power usage efficiency. 100% of the emissions are directly offset by Meta's sustainability program, and because we are openly releasing these models, the pretraining costs do not need to be incurred by others. + + +## Training Data + +**Overview** Llama 3 was pretrained on over 15 trillion tokens of data from publicly available sources. The fine-tuning data includes publicly available instruction datasets, as well as over 10M human-annotated examples. Neither the pretraining nor the fine-tuning datasets include Meta user data. + +**Data Freshness** The pretraining data has a cutoff of March 2023 for the 7B and December 2023 for the 70B models respectively. + + +## Benchmarks + +In this section, we report the results for Llama 3 models on standard automatic benchmarks. For all the evaluations, we use our internal evaluations library. For details on the methodology see [here](https://github.com/meta-llama/llama3/blob/main/eval_methodology.md). + + +### Base pretrained models + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Category + Benchmark + Llama 3 8B + Llama2 7B + Llama2 13B + Llama 3 70B + Llama2 70B +
General + MMLU (5-shot) + 66.6 + 45.7 + 53.8 + 79.5 + 69.7 +
AGIEval English (3-5 shot) + 45.9 + 28.8 + 38.7 + 63.0 + 54.8 +
CommonSenseQA (7-shot) + 72.6 + 57.6 + 67.6 + 83.8 + 78.7 +
Winogrande (5-shot) + 76.1 + 73.3 + 75.4 + 83.1 + 81.8 +
BIG-Bench Hard (3-shot, CoT) + 61.1 + 38.1 + 47.0 + 81.3 + 65.7 +
ARC-Challenge (25-shot) + 78.6 + 53.7 + 67.6 + 93.0 + 85.3 +
Knowledge reasoning + TriviaQA-Wiki (5-shot) + 78.5 + 72.1 + 79.6 + 89.7 + 87.5 +
Reading comprehension + SQuAD (1-shot) + 76.4 + 72.2 + 72.1 + 85.6 + 82.6 +
QuAC (1-shot, F1) + 44.4 + 39.6 + 44.9 + 51.1 + 49.4 +
BoolQ (0-shot) + 75.7 + 65.5 + 66.9 + 79.0 + 73.1 +
DROP (3-shot, F1) + 58.4 + 37.9 + 49.8 + 79.7 + 70.2 +
+ + + +### Instruction tuned models + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Benchmark + Llama 3 8B + Llama 2 7B + Llama 2 13B + Llama 3 70B + Llama 2 70B +
MMLU (5-shot) + 68.4 + 34.1 + 47.8 + 82.0 + 52.9 +
GPQA (0-shot) + 34.2 + 21.7 + 22.3 + 39.5 + 21.0 +
HumanEval (0-shot) + 62.2 + 7.9 + 14.0 + 81.7 + 25.6 +
GSM-8K (8-shot, CoT) + 79.6 + 25.7 + 77.4 + 93.0 + 57.5 +
MATH (4-shot, CoT) + 30.0 + 3.8 + 6.7 + 50.4 + 11.6 +
+ + + +### Responsibility & Safety + +We believe that an open approach to AI leads to better, safer products, faster innovation, and a bigger overall market. We are committed to Responsible AI development and took a series of steps to limit misuse and harm and support the open source community. + +Foundation models are widely capable technologies that are built to be used for a diverse range of applications. They are not designed to meet every developer preference on safety levels for all use cases, out-of-the-box, as those by their nature will differ across different applications. + +Rather, responsible LLM-application deployment is achieved by implementing a series of safety best practices throughout the development of such applications, from the model pre-training, fine-tuning and the deployment of systems composed of safeguards to tailor the safety needs specifically to the use case and audience. + + +As part of the Llama 3 release, we updated our [Responsible Use Guide](https://llama.meta.com/responsible-use-guide/) to outline the steps and best practices for developers to implement model and system level safety for their application. We also provide a set of resources including [Meta Llama Guard 2](https://llama.meta.com/purple-llama/) and [Code Shield](https://llama.meta.com/purple-llama/) safeguards. These tools have proven to drastically reduce residual risks of LLM Systems, while maintaining a high level of helpfulness. We encourage developers to tune and deploy these safeguards according to their needs and we provide a [reference implementation](https://github.com/meta-llama/llama-recipes/tree/main/recipes/responsible_ai) to get you started. + + +#### Llama 3-Instruct + +As outlined in the Responsible Use Guide, some trade-off between model helpfulness and model alignment is likely unavoidable. Developers should exercise discretion about how to weigh the benefits of alignment and helpfulness for their specific use case and audience. Developers should be mindful of residual risks when using Llama models and leverage additional safety tools as needed to reach the right safety bar for their use case. + +Safety + +For our instruction tuned model, we conducted extensive red teaming exercises, performed adversarial evaluations and implemented safety mitigations techniques to lower residual risks. As with any Large Language Model, residual risks will likely remain and we recommend that developers assess these risks in the context of their use case. In parallel, we are working with the community to make AI safety benchmark standards transparent, rigorous and interpretable. + +Refusals + +In addition to residual risks, we put a great emphasis on model refusals to benign prompts. Over-refusing not only can impact the user experience but could even be harmful in certain contexts as well. We’ve heard the feedback from the developer community and improved our fine tuning to ensure that Llama 3 is significantly less likely to falsely refuse to answer prompts than Llama 2. + +We built internal benchmarks and developed mitigations to limit false refusals making Llama 3 our most helpful model to date. + + +#### Responsible release + +In addition to responsible use considerations outlined above, we followed a rigorous process that requires us to take extra measures against misuse and critical risks before we make our release decision. + +Misuse + +If you access or use Llama 3, you agree to the Acceptable Use Policy. The most recent copy of this policy can be found at [https://llama.meta.com/llama3/use-policy/](https://llama.meta.com/llama3/use-policy/). + + +#### Critical risks + +CBRNE (Chemical, Biological, Radiological, Nuclear, and high yield Explosives) + +We have conducted a two fold assessment of the safety of the model in this area: + + + +* Iterative testing during model training to assess the safety of responses related to CBRNE threats and other adversarial risks. +* Involving external CBRNE experts to conduct an uplift test assessing the ability of the model to accurately provide expert knowledge and reduce barriers to potential CBRNE misuse, by reference to what can be achieved using web search (without the model). + + +### Cyber Security + +We have evaluated Llama 3 with CyberSecEval, Meta’s cybersecurity safety eval suite, measuring Llama 3’s propensity to suggest insecure code when used as a coding assistant, and Llama 3’s propensity to comply with requests to help carry out cyber attacks, where attacks are defined by the industry standard MITRE ATT&CK cyber attack ontology. On our insecure coding and cyber attacker helpfulness tests, Llama 3 behaved in the same range or safer than models of [equivalent coding capability](https://huggingface.co/spaces/facebook/CyberSecEval). + + +### Child Safety + +Child Safety risk assessments were conducted using a team of experts, to assess the model’s capability to produce outputs that could result in Child Safety risks and inform on any necessary and appropriate risk mitigations via fine tuning. We leveraged those expert red teaming sessions to expand the coverage of our evaluation benchmarks through Llama 3 model development. For Llama 3, we conducted new in-depth sessions using objective based methodologies to assess the model risks along multiple attack vectors. We also partnered with content specialists to perform red teaming exercises assessing potentially violating content while taking account of market specific nuances or experiences. + + +### Community + +Generative AI safety requires expertise and tooling, and we believe in the strength of the open community to accelerate its progress. We are active members of open consortiums, including the AI Alliance, Partnership in AI and MLCommons, actively contributing to safety standardization and transparency. We encourage the community to adopt taxonomies like the MLCommons Proof of Concept evaluation to facilitate collaboration and transparency on safety and content evaluations. Our Purple Llama tools are open sourced for the community to use and widely distributed across ecosystem partners including cloud service providers. We encourage community contributions to our [Github repository](https://github.com/meta-llama/PurpleLlama). + +Finally, we put in place a set of resources including an [output reporting mechanism](https://developers.facebook.com/llama_output_feedback) and [bug bounty program](https://www.facebook.com/whitehat) to continuously improve the Llama technology with the help of the community. + + +## Ethical Considerations and Limitations + +The core values of Llama 3 are openness, inclusivity and helpfulness. It is meant to serve everyone, and to work for a wide range of use cases. It is thus designed to be accessible to people across many different backgrounds, experiences and perspectives. Llama 3 addresses users and their needs as they are, without insertion unnecessary judgment or normativity, while reflecting the understanding that even content that may appear problematic in some cases can serve valuable purposes in others. It respects the dignity and autonomy of all users, especially in terms of the values of free thought and expression that power innovation and progress. + +But Llama 3 is a new technology, and like any new technology, there are risks associated with its 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, Llama 3’s potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate, biased or other objectionable responses to user prompts. Therefore, before deploying any applications of Llama 3 models, developers should perform safety testing and tuning tailored to their specific applications of the model. As outlined in the Responsible Use Guide, we recommend incorporating [Purple Llama](https://github.com/facebookresearch/PurpleLlama) solutions into your workflows and specifically [Llama Guard](https://ai.meta.com/research/publications/llama-guard-llm-based-input-output-safeguard-for-human-ai-conversations/) which provides a base model to filter input and output prompts to layer system-level safety on top of model-level safety. + +Please see the Responsible Use Guide available at [http://llama.meta.com/responsible-use-guide](http://llama.meta.com/responsible-use-guide) + + +## Citation instructions + +@article{llama3modelcard, + + title={Llama 3 Model Card}, + + author={AI@Meta}, + + year={2024}, + + url = {https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md} + +} + +## Contributors + +Aaditya Singh; Aaron Grattafiori; Abhimanyu Dubey; Abhinav Jauhri; Abhinav Pandey; Abhishek Kadian; Adam Kelsey; Adi Gangidi; Ahmad Al-Dahle; Ahuva Goldstand; Aiesha Letman; Ajay Menon; Akhil Mathur; Alan Schelten; Alex Vaughan; Amy Yang; Andrei Lupu; Andres Alvarado; Andrew Gallagher; Andrew Gu; Andrew Ho; Andrew Poulton; Andrew Ryan; Angela Fan; Ankit Ramchandani; Anthony Hartshorn; Archi Mitra; Archie Sravankumar; Artem Korenev; Arun Rao; Ashley Gabriel; Ashwin Bharambe; Assaf Eisenman; Aston Zhang; Aurelien Rodriguez; Austen Gregerson; Ava Spataru; Baptiste Roziere; Ben Maurer; Benjamin Leonhardi; Bernie Huang; Bhargavi Paranjape; Bing Liu; Binh Tang; Bobbie Chern; Brani Stojkovic; Brian Fuller; Catalina Mejia Arenas; Chao Zhou; Charlotte Caucheteux; Chaya Nayak; Ching-Hsiang Chu; Chloe Bi; Chris Cai; Chris Cox; Chris Marra; Chris McConnell; Christian Keller; Christoph Feichtenhofer; Christophe Touret; Chunyang Wu; Corinne Wong; Cristian Canton Ferrer; Damien Allonsius; Daniel Kreymer; Daniel Haziza; Daniel Li; Danielle Pintz; Danny Livshits; Danny Wyatt; David Adkins; David Esiobu; David Xu; Davide Testuggine; Delia David; Devi Parikh; Dhruv Choudhary; Dhruv Mahajan; Diana Liskovich; Diego Garcia-Olano; Diego Perino; Dieuwke Hupkes; Dingkang Wang; Dustin Holland; Egor Lakomkin; Elina Lobanova; Xiaoqing Ellen Tan; Emily Dinan; Eric Smith; Erik Brinkman; Esteban Arcaute; Filip Radenovic; Firat Ozgenel; Francesco Caggioni; Frank Seide; Frank Zhang; Gabriel Synnaeve; Gabriella Schwarz; Gabrielle Lee; Gada Badeer; Georgia Anderson; Graeme Nail; Gregoire Mialon; Guan Pang; Guillem Cucurell; Hailey Nguyen; Hannah Korevaar; Hannah Wang; Haroun Habeeb; Harrison Rudolph; Henry Aspegren; Hu Xu; Hugo Touvron; Iga Kozlowska; Igor Molybog; Igor Tufanov; Iliyan Zarov; Imanol Arrieta Ibarra; Irina-Elena Veliche; Isabel Kloumann; Ishan Misra; Ivan Evtimov; Jacob Xu; Jade Copet; Jake Weissman; Jan Geffert; Jana Vranes; Japhet Asher; Jason Park; Jay Mahadeokar; Jean-Baptiste Gaya; Jeet Shah; Jelmer van der Linde; Jennifer Chan; Jenny Hong; Jenya Lee; Jeremy Fu; Jeremy Teboul; Jianfeng Chi; Jianyu Huang; Jie Wang; Jiecao Yu; Joanna Bitton; Joe Spisak; Joelle Pineau; Jon Carvill; Jongsoo Park; Joseph Rocca; Joshua Johnstun; Junteng Jia; Kalyan Vasuden Alwala; Kam Hou U; Kate Plawiak; Kartikeya Upasani; Kaushik Veeraraghavan; Ke Li; Kenneth Heafield; Kevin Stone; Khalid El-Arini; Krithika Iyer; Kshitiz Malik; Kuenley Chiu; Kunal Bhalla; Kyle Huang; Lakshya Garg; Lauren Rantala-Yeary; Laurens van der Maaten; Lawrence Chen; Leandro Silva; Lee Bell; Lei Zhang; Liang Tan; Louis Martin; Lovish Madaan; Luca Wehrstedt; Lukas Blecher; Luke de Oliveira; Madeline Muzzi; Madian Khabsa; Manav Avlani; Mannat Singh; Manohar Paluri; Mark Zuckerberg; Marcin Kardas; Martynas Mankus; Mathew Oldham; Mathieu Rita; Matthew Lennie; Maya Pavlova; Meghan Keneally; Melanie Kambadur; Mihir Patel; Mikayel Samvelyan; Mike Clark; Mike Lewis; Min Si; Mitesh Kumar Singh; Mo Metanat; Mona Hassan; Naman Goyal; Narjes Torabi; Nicolas Usunier; Nikolay Bashlykov; Nikolay Bogoychev; Niladri Chatterji; Ning Dong; Oliver Aobo Yang; Olivier Duchenne; Onur Celebi; Parth Parekh; Patrick Alrassy; Paul Saab; Pavan Balaji; Pedro Rittner; Pengchuan Zhang; Pengwei Li; Petar Vasic; Peter Weng; Polina Zvyagina; Prajjwal Bhargava; Pratik Dubal; Praveen Krishnan; Punit Singh Koura; Qing He; Rachel Rodriguez; Ragavan Srinivasan; Rahul Mitra; Ramon Calderer; Raymond Li; Robert Stojnic; Roberta Raileanu; Robin Battey; Rocky Wang; Rohit Girdhar; Rohit Patel; Romain Sauvestre; Ronnie Polidoro; Roshan Sumbaly; Ross Taylor; Ruan Silva; Rui Hou; Rui Wang; Russ Howes; Ruty Rinott; Saghar Hosseini; Sai Jayesh Bondu; Samyak Datta; Sanjay Singh; Sara Chugh; Sargun Dhillon; Satadru Pan; Sean Bell; Sergey Edunov; Shaoliang Nie; Sharan Narang; Sharath Raparthy; Shaun Lindsay; Sheng Feng; Sheng Shen; Shenghao Lin; Shiva Shankar; Shruti Bhosale; Shun Zhang; Simon Vandenhende; Sinong Wang; Seohyun Sonia Kim; Soumya Batra; Sten Sootla; Steve Kehoe; Suchin Gururangan; Sumit Gupta; Sunny Virk; Sydney Borodinsky; Tamar Glaser; Tamar Herman; Tamara Best; Tara Fowler; Thomas Georgiou; Thomas Scialom; Tianhe Li; Todor Mihaylov; Tong Xiao; Ujjwal Karn; Vedanuj Goswami; Vibhor Gupta; Vignesh Ramanathan; Viktor Kerkez; Vinay Satish Kumar; Vincent Gonguet; Vish Vogeti; Vlad Poenaru; Vlad Tiberiu Mihailescu; Vladan Petrovic; Vladimir Ivanov; Wei Li; Weiwei Chu; Wenhan Xiong; Wenyin Fu; Wes Bouaziz; Whitney Meers; Will Constable; Xavier Martinet; Xiaojian Wu; Xinbo Gao; Xinfeng Xie; Xuchao Jia; Yaelle Goldschlag; Yann LeCun; Yashesh Gaur; Yasmine Babaei; Ye Qi; Yenda Li; Yi Wen; Yiwen Song; Youngjin Nam; Yuchen Hao; Yuchen Zhang; Yun Wang; Yuning Mao; Yuzi He; Zacharie Delpierre Coudert; Zachary DeVito; Zahra Hankir; Zhaoduo Wen; Zheng Yan; Zhengxing Chen; Zhenyu Yang; Zoe Papakipos diff --git a/models/llm/Meta-Llama-3-8B/README.md b/models/llm/Meta-Llama-3-8B/README.md new file mode 100644 index 0000000..485890d --- /dev/null +++ b/models/llm/Meta-Llama-3-8B/README.md @@ -0,0 +1,735 @@ +--- +language: +- en +pipeline_tag: text-generation +tags: +- facebook +- meta +- pytorch +- llama +- llama-3 +license: other +license_name: llama3 +license_link: LICENSE +extra_gated_prompt: >- + ### META LLAMA 3 COMMUNITY LICENSE AGREEMENT + + Meta Llama 3 Version Release Date: April 18, 2024 + + "Agreement" means the terms and conditions for use, reproduction, distribution and modification of the + Llama Materials set forth herein. + + "Documentation" means the specifications, manuals and documentation accompanying Meta Llama 3 + distributed by Meta at https://llama.meta.com/get-started/. + + "Licensee" or "you" means you, or your employer or any other person or entity (if you are entering into + this Agreement on such person or entity’s behalf), of the age required under applicable laws, rules or + regulations to provide legal consent and that has legal authority to bind your employer or such other + person or entity if you are entering in this Agreement on their behalf. + + "Meta Llama 3" means the foundational large language models and software and algorithms, including + machine-learning model code, trained model weights, inference-enabling code, training-enabling code, + fine-tuning enabling code and other elements of the foregoing distributed by Meta at + https://llama.meta.com/llama-downloads. + + "Llama Materials" means, collectively, Meta’s proprietary Meta Llama 3 and Documentation (and any + portion thereof) made available under this Agreement. + + "Meta" or "we" means Meta Platforms Ireland Limited (if you are located in or, if you are an entity, your + principal place of business is in the EEA or Switzerland) and Meta Platforms, Inc. (if you are located + outside of the EEA or Switzerland). + + 1. License Rights and Redistribution. + + a. Grant of Rights. You are granted a non-exclusive, worldwide, non-transferable and royalty-free + limited license under Meta’s intellectual property or other rights owned by Meta embodied in the Llama + Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the + Llama Materials. + + b. Redistribution and Use. + + i. If you distribute or make available the Llama Materials (or any derivative works + thereof), or a product or service that uses any of them, including another AI model, you shall (A) provide + a copy of this Agreement with any such Llama Materials; and (B) prominently display “Built with Meta + Llama 3” on a related website, user interface, blogpost, about page, or product documentation. If you + use the Llama Materials to create, train, fine tune, or otherwise improve an AI model, which is + distributed or made available, you shall also include “Llama 3” at the beginning of any such AI model + name. + + ii. If you receive Llama Materials, or any derivative works thereof, from a Licensee as part + of an integrated end user product, then Section 2 of this Agreement will not apply to you. + + iii. You must retain in all copies of the Llama Materials that you distribute the following + attribution notice within a “Notice” text file distributed as a part of such copies: “Meta Llama 3 is + licensed under the Meta Llama 3 Community License, Copyright © Meta Platforms, Inc. All Rights + Reserved.” + + iv. Your use of the Llama Materials must comply with applicable laws and regulations + (including trade compliance laws and regulations) and adhere to the Acceptable Use Policy for the Llama + Materials (available at https://llama.meta.com/llama3/use-policy), which is hereby incorporated by + reference into this Agreement. + + v. You will not use the Llama Materials or any output or results of the Llama Materials to + improve any other large language model (excluding Meta Llama 3 or derivative works thereof). + + 2. Additional Commercial Terms. If, on the Meta Llama 3 version release date, the monthly active users + of the products or services made available by or for Licensee, or Licensee’s affiliates, is greater than 700 + million monthly active users in the preceding calendar month, you must request a license from Meta, + which Meta may grant to you in its sole discretion, and you are not authorized to exercise any of the + rights under this Agreement unless or until Meta otherwise expressly grants you such rights. + + 3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY + OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF + ANY KIND, AND META DISCLAIMS ALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND IMPLIED, + INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, + MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR + DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS AND + ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE LLAMA MATERIALS AND ANY OUTPUT AND + RESULTS. + + 4. Limitation of Liability. IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING + OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, + INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF META OR ITS AFFILIATES HAVE BEEN ADVISED + OF THE POSSIBILITY OF ANY OF THE FOREGOING. + + 5. Intellectual Property. + + a. No trademark licenses are granted under this Agreement, and in connection with the Llama + Materials, neither Meta nor Licensee may use any name or mark owned by or associated with the other + or any of its affiliates, except as required for reasonable and customary use in describing and + redistributing the Llama Materials or as set forth in this Section 5(a). Meta hereby grants you a license to + use “Llama 3” (the “Mark”) solely as required to comply with the last sentence of Section 1.b.i. You will + comply with Meta’s brand guidelines (currently accessible at + https://about.meta.com/brand/resources/meta/company-brand/ ). All goodwill arising out of your use + of the Mark will inure to the benefit of Meta. + + b. Subject to Meta’s ownership of Llama Materials and derivatives made by or for Meta, with + respect to any derivative works and modifications of the Llama Materials that are made by you, as + between you and Meta, you are and will be the owner of such derivative works and modifications. + + c. If you institute litigation or other proceedings against Meta or any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Llama Materials or Meta Llama 3 outputs or + results, or any portion of any of the foregoing, constitutes infringement of intellectual property or other + rights owned or licensable by you, then any licenses granted to you under this Agreement shall + terminate as of the date such litigation or claim is filed or instituted. You will indemnify and hold + harmless Meta from and against any claim by any third party arising out of or related to your use or + distribution of the Llama Materials. + + 6. Term and Termination. The term of this Agreement will commence upon your acceptance of this + Agreement or access to the Llama Materials and will continue in full force and effect until terminated in + accordance with the terms and conditions herein. Meta may terminate this Agreement if you are in + breach of any term or condition of this Agreement. Upon termination of this Agreement, you shall delete + and cease use of the Llama Materials. Sections 3, 4 and 7 shall survive the termination of this + Agreement. + + 7. Governing Law and Jurisdiction. This Agreement will be governed and construed under the laws of + the State of California without regard to choice of law principles, and the UN Convention on Contracts + for the International Sale of Goods does not apply to this Agreement. The courts of California shall have + exclusive jurisdiction of any dispute arising out of this Agreement. + + ### Meta Llama 3 Acceptable Use Policy + + Meta is committed to promoting safe and fair use of its tools and features, including Meta Llama 3. If you + access or use Meta Llama 3, you agree to this Acceptable Use Policy (“Policy”). The most recent copy of + this policy can be found at [https://llama.meta.com/llama3/use-policy](https://llama.meta.com/llama3/use-policy) + + #### Prohibited Uses + + We want everyone to use Meta Llama 3 safely and responsibly. You agree you will not use, or allow + others to use, Meta Llama 3 to: + 1. Violate the law or others’ rights, including to: + 1. Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as: + 1. Violence or terrorism + 2. Exploitation or harm to children, including the solicitation, creation, acquisition, or dissemination of child exploitative content or failure to report Child Sexual Abuse Material + 3. Human trafficking, exploitation, and sexual violence + 4. The illegal distribution of information or materials to minors, including obscene materials, or failure to employ legally required age-gating in connection with such information or materials. + 5. Sexual solicitation + 6. Any other criminal activity + 2. Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals + 3. Engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, other economic benefits, or other essential goods and services + 4. Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices + 5. Collect, process, disclose, generate, or infer health, demographic, or other sensitive personal or private information about individuals without rights and consents required by applicable laws + 6. Engage in or facilitate any action or generate any content that infringes, misappropriates, or otherwise violates any third-party rights, including the outputs or results of any products or services using the Llama Materials + 7. Create, generate, or facilitate the creation of malicious code, malware, computer viruses or do anything else that could disable, overburden, interfere with or impair the proper working, integrity, operation or appearance of a website or computer system + 2. Engage in, promote, incite, facilitate, or assist in the planning or development of activities that present a risk of death or bodily harm to individuals, including use of Meta Llama 3 related to the following: + 1. Military, warfare, nuclear industries or applications, espionage, use for materials or activities that are subject to the International Traffic Arms Regulations (ITAR) maintained by the United States Department of State + 2. Guns and illegal weapons (including weapon development) + 3. Illegal drugs and regulated/controlled substances + 4. Operation of critical infrastructure, transportation technologies, or heavy machinery + 5. Self-harm or harm to others, including suicide, cutting, and eating disorders + 6. Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual + 3. Intentionally deceive or mislead others, including use of Meta Llama 3 related to the following: + 1. Generating, promoting, or furthering fraud or the creation or promotion of disinformation + 2. Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content + 3. Generating, promoting, or further distributing spam + 4. Impersonating another individual without consent, authorization, or legal right + 5. Representing that the use of Meta Llama 3 or outputs are human-generated + 6. Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement + 4. Fail to appropriately disclose to end users any known dangers of your AI system + + Please report any violation of this Policy, software “bug,” or other problems that could lead to a violation + of this Policy through one of the following means: + * Reporting issues with the model: [https://github.com/meta-llama/llama3](https://github.com/meta-llama/llama3) + * Reporting risky content generated by the model: + developers.facebook.com/llama_output_feedback + * Reporting bugs and security concerns: facebook.com/whitehat/info + * Reporting violations of the Acceptable Use Policy or unlicensed uses of Meta Llama 3: LlamaUseReport@meta.com +extra_gated_fields: + First Name: text + Last Name: text + Date of birth: date_picker + Country: country + Affiliation: text + geo: ip_location + By clicking Submit below I accept the terms of the license and acknowledge that the information I provide will be collected stored processed and shared in accordance with the Meta Privacy Policy: checkbox +extra_gated_description: The information you provide will be collected, stored, processed and shared in accordance with the [Meta Privacy Policy](https://www.facebook.com/privacy/policy/). +extra_gated_button_content: Submit +--- + +## Model Details + +Meta developed and released the Meta Llama 3 family of large language models (LLMs), a collection of pretrained and instruction tuned generative text models in 8 and 70B sizes. The Llama 3 instruction tuned models are optimized for dialogue use cases and outperform many of the available open source chat models on common industry benchmarks. Further, in developing these models, we took great care to optimize helpfulness and safety. + +**Model developers** Meta + +**Variations** Llama 3 comes in two sizes — 8B and 70B parameters — in pre-trained and instruction tuned variants. + +**Input** Models input text only. + +**Output** Models generate text and code only. + +**Model Architecture** Llama 3 is an auto-regressive language model that uses an optimized transformer architecture. The tuned versions use supervised fine-tuning (SFT) and reinforcement learning with human feedback (RLHF) to align with human preferences for helpfulness and safety. + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Training Data + Params + Context length + GQA + Token count + Knowledge cutoff +
Llama 3 + A new mix of publicly available online data. + 8B + 8k + Yes + 15T+ + March, 2023 +
70B + 8k + Yes + December, 2023 +
+ + +**Llama 3 family of models**. Token counts refer to pretraining data only. Both the 8 and 70B versions use Grouped-Query Attention (GQA) for improved inference scalability. + +**Model Release Date** April 18, 2024. + +**Status** This is a static model trained on an offline dataset. Future versions of the tuned models will be released as we improve model safety with community feedback. + +**License** A custom commercial license is available at: [https://llama.meta.com/llama3/license](https://llama.meta.com/llama3/license) + +Where to send questions or comments about the model Instructions on how to provide feedback or comments on the model can be found in the model [README](https://github.com/meta-llama/llama3). For more technical information about generation parameters and recipes for how to use Llama 3 in applications, please go [here](https://github.com/meta-llama/llama-recipes). + + +## Intended Use + +**Intended Use Cases** Llama 3 is intended for commercial and research use in English. Instruction tuned models are intended for assistant-like chat, whereas pretrained models can be adapted for a variety of natural language generation tasks. + +**Out-of-scope** Use in any manner that violates applicable laws or regulations (including trade compliance laws). Use in any other way that is prohibited by the Acceptable Use Policy and Llama 3 Community License. Use in languages other than English**. + +**Note: Developers may fine-tune Llama 3 models for languages beyond English provided they comply with the Llama 3 Community License and the Acceptable Use Policy. + +## How to use + +This repository contains two versions of Meta-Llama-3-8B, for use with transformers and with the original `llama3` codebase. + +### Use with transformers + +See the snippet below for usage with Transformers: + +```python +>>> import transformers +>>> import torch + +>>> model_id = "meta-llama/Meta-Llama-3-8B" + +>>> pipeline = transformers.pipeline( + "text-generation", model=model_id, model_kwargs={"torch_dtype": torch.bfloat16}, device_map="auto" +) +>>> pipeline("Hey how are you doing today?") +``` + +### Use with `llama3` + +Please, follow the instructions in the [repository](https://github.com/meta-llama/llama3). + +To download Original checkpoints, see the example command below leveraging `huggingface-cli`: + +``` +huggingface-cli download meta-llama/Meta-Llama-3-8B --include "original/*" --local-dir Meta-Llama-3-8B +``` + +For Hugging Face support, we recommend using transformers or TGI, but a similar command works. + +## Hardware and Software + +**Training Factors** We used custom training libraries, Meta's Research SuperCluster, and production clusters for pretraining. Fine-tuning, annotation, and evaluation were also performed on third-party cloud compute. + +**Carbon Footprint Pretraining utilized a cumulative** 7.7M GPU hours of computation on hardware of type H100-80GB (TDP of 700W). Estimated total emissions were 2290 tCO2eq, 100% of which were offset by Meta’s sustainability program. + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Time (GPU hours) + Power Consumption (W) + Carbon Emitted(tCO2eq) +
Llama 3 8B + 1.3M + 700 + 390 +
Llama 3 70B + 6.4M + 700 + 1900 +
Total + 7.7M + + 2290 +
+ + + +**CO2 emissions during pre-training**. Time: total GPU time required for training each model. Power Consumption: peak power capacity per GPU device for the GPUs used adjusted for power usage efficiency. 100% of the emissions are directly offset by Meta's sustainability program, and because we are openly releasing these models, the pretraining costs do not need to be incurred by others. + + +## Training Data + +**Overview** Llama 3 was pretrained on over 15 trillion tokens of data from publicly available sources. The fine-tuning data includes publicly available instruction datasets, as well as over 10M human-annotated examples. Neither the pretraining nor the fine-tuning datasets include Meta user data. + +**Data Freshness** The pretraining data has a cutoff of March 2023 for the 7B and December 2023 for the 70B models respectively. + + +## Benchmarks + +In this section, we report the results for Llama 3 models on standard automatic benchmarks. For all the evaluations, we use our internal evaluations library. For details on the methodology see [here](https://github.com/meta-llama/llama3/blob/main/eval_methodology.md). + + +### Base pretrained models + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Category + Benchmark + Llama 3 8B + Llama2 7B + Llama2 13B + Llama 3 70B + Llama2 70B +
General + MMLU (5-shot) + 66.6 + 45.7 + 53.8 + 79.5 + 69.7 +
AGIEval English (3-5 shot) + 45.9 + 28.8 + 38.7 + 63.0 + 54.8 +
CommonSenseQA (7-shot) + 72.6 + 57.6 + 67.6 + 83.8 + 78.7 +
Winogrande (5-shot) + 76.1 + 73.3 + 75.4 + 83.1 + 81.8 +
BIG-Bench Hard (3-shot, CoT) + 61.1 + 38.1 + 47.0 + 81.3 + 65.7 +
ARC-Challenge (25-shot) + 78.6 + 53.7 + 67.6 + 93.0 + 85.3 +
Knowledge reasoning + TriviaQA-Wiki (5-shot) + 78.5 + 72.1 + 79.6 + 89.7 + 87.5 +
Reading comprehension + SQuAD (1-shot) + 76.4 + 72.2 + 72.1 + 85.6 + 82.6 +
QuAC (1-shot, F1) + 44.4 + 39.6 + 44.9 + 51.1 + 49.4 +
BoolQ (0-shot) + 75.7 + 65.5 + 66.9 + 79.0 + 73.1 +
DROP (3-shot, F1) + 58.4 + 37.9 + 49.8 + 79.7 + 70.2 +
+ + + +### Instruction tuned models + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Benchmark + Llama 3 8B + Llama 2 7B + Llama 2 13B + Llama 3 70B + Llama 2 70B +
MMLU (5-shot) + 68.4 + 34.1 + 47.8 + 82.0 + 52.9 +
GPQA (0-shot) + 34.2 + 21.7 + 22.3 + 39.5 + 21.0 +
HumanEval (0-shot) + 62.2 + 7.9 + 14.0 + 81.7 + 25.6 +
GSM-8K (8-shot, CoT) + 79.6 + 25.7 + 77.4 + 93.0 + 57.5 +
MATH (4-shot, CoT) + 30.0 + 3.8 + 6.7 + 50.4 + 11.6 +
+ + + +### Responsibility & Safety + +We believe that an open approach to AI leads to better, safer products, faster innovation, and a bigger overall market. We are committed to Responsible AI development and took a series of steps to limit misuse and harm and support the open source community. + +Foundation models are widely capable technologies that are built to be used for a diverse range of applications. They are not designed to meet every developer preference on safety levels for all use cases, out-of-the-box, as those by their nature will differ across different applications. + +Rather, responsible LLM-application deployment is achieved by implementing a series of safety best practices throughout the development of such applications, from the model pre-training, fine-tuning and the deployment of systems composed of safeguards to tailor the safety needs specifically to the use case and audience. + + +As part of the Llama 3 release, we updated our [Responsible Use Guide](https://llama.meta.com/responsible-use-guide/) to outline the steps and best practices for developers to implement model and system level safety for their application. We also provide a set of resources including [Meta Llama Guard 2](https://llama.meta.com/purple-llama/) and [Code Shield](https://llama.meta.com/purple-llama/) safeguards. These tools have proven to drastically reduce residual risks of LLM Systems, while maintaining a high level of helpfulness. We encourage developers to tune and deploy these safeguards according to their needs and we provide a [reference implementation](https://github.com/meta-llama/llama-recipes/tree/main/recipes/responsible_ai) to get you started. + + +#### Llama 3-Instruct + +As outlined in the Responsible Use Guide, some trade-off between model helpfulness and model alignment is likely unavoidable. Developers should exercise discretion about how to weigh the benefits of alignment and helpfulness for their specific use case and audience. Developers should be mindful of residual risks when using Llama models and leverage additional safety tools as needed to reach the right safety bar for their use case. + +Safety + +For our instruction tuned model, we conducted extensive red teaming exercises, performed adversarial evaluations and implemented safety mitigations techniques to lower residual risks. As with any Large Language Model, residual risks will likely remain and we recommend that developers assess these risks in the context of their use case. In parallel, we are working with the community to make AI safety benchmark standards transparent, rigorous and interpretable. + +Refusals + +In addition to residual risks, we put a great emphasis on model refusals to benign prompts. Over-refusing not only can impact the user experience but could even be harmful in certain contexts as well. We’ve heard the feedback from the developer community and improved our fine tuning to ensure that Llama 3 is significantly less likely to falsely refuse to answer prompts than Llama 2. + +We built internal benchmarks and developed mitigations to limit false refusals making Llama 3 our most helpful model to date. + + +#### Responsible release + +In addition to responsible use considerations outlined above, we followed a rigorous process that requires us to take extra measures against misuse and critical risks before we make our release decision. + +Misuse + +If you access or use Llama 3, you agree to the Acceptable Use Policy. The most recent copy of this policy can be found at [https://llama.meta.com/llama3/use-policy/](https://llama.meta.com/llama3/use-policy/). + + +#### Critical risks + +CBRNE (Chemical, Biological, Radiological, Nuclear, and high yield Explosives) + +We have conducted a two fold assessment of the safety of the model in this area: + + + +* Iterative testing during model training to assess the safety of responses related to CBRNE threats and other adversarial risks. +* Involving external CBRNE experts to conduct an uplift test assessing the ability of the model to accurately provide expert knowledge and reduce barriers to potential CBRNE misuse, by reference to what can be achieved using web search (without the model). + + +### Cyber Security + +We have evaluated Llama 3 with CyberSecEval, Meta’s cybersecurity safety eval suite, measuring Llama 3’s propensity to suggest insecure code when used as a coding assistant, and Llama 3’s propensity to comply with requests to help carry out cyber attacks, where attacks are defined by the industry standard MITRE ATT&CK cyber attack ontology. On our insecure coding and cyber attacker helpfulness tests, Llama 3 behaved in the same range or safer than models of [equivalent coding capability](https://huggingface.co/spaces/facebook/CyberSecEval). + + +### Child Safety + +Child Safety risk assessments were conducted using a team of experts, to assess the model’s capability to produce outputs that could result in Child Safety risks and inform on any necessary and appropriate risk mitigations via fine tuning. We leveraged those expert red teaming sessions to expand the coverage of our evaluation benchmarks through Llama 3 model development. For Llama 3, we conducted new in-depth sessions using objective based methodologies to assess the model risks along multiple attack vectors. We also partnered with content specialists to perform red teaming exercises assessing potentially violating content while taking account of market specific nuances or experiences. + + +### Community + +Generative AI safety requires expertise and tooling, and we believe in the strength of the open community to accelerate its progress. We are active members of open consortiums, including the AI Alliance, Partnership in AI and MLCommons, actively contributing to safety standardization and transparency. We encourage the community to adopt taxonomies like the MLCommons Proof of Concept evaluation to facilitate collaboration and transparency on safety and content evaluations. Our Purple Llama tools are open sourced for the community to use and widely distributed across ecosystem partners including cloud service providers. We encourage community contributions to our [Github repository](https://github.com/meta-llama/PurpleLlama). + +Finally, we put in place a set of resources including an [output reporting mechanism](https://developers.facebook.com/llama_output_feedback) and [bug bounty program](https://www.facebook.com/whitehat) to continuously improve the Llama technology with the help of the community. + + +## Ethical Considerations and Limitations + +The core values of Llama 3 are openness, inclusivity and helpfulness. It is meant to serve everyone, and to work for a wide range of use cases. It is thus designed to be accessible to people across many different backgrounds, experiences and perspectives. Llama 3 addresses users and their needs as they are, without insertion unnecessary judgment or normativity, while reflecting the understanding that even content that may appear problematic in some cases can serve valuable purposes in others. It respects the dignity and autonomy of all users, especially in terms of the values of free thought and expression that power innovation and progress. + +But Llama 3 is a new technology, and like any new technology, there are risks associated with its 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, Llama 3’s potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate, biased or other objectionable responses to user prompts. Therefore, before deploying any applications of Llama 3 models, developers should perform safety testing and tuning tailored to their specific applications of the model. As outlined in the Responsible Use Guide, we recommend incorporating [Purple Llama](https://github.com/facebookresearch/PurpleLlama) solutions into your workflows and specifically [Llama Guard](https://ai.meta.com/research/publications/llama-guard-llm-based-input-output-safeguard-for-human-ai-conversations/) which provides a base model to filter input and output prompts to layer system-level safety on top of model-level safety. + +Please see the Responsible Use Guide available at [http://llama.meta.com/responsible-use-guide](http://llama.meta.com/responsible-use-guide) + + +## Citation instructions + +@article{llama3modelcard, + + title={Llama 3 Model Card}, + + author={AI@Meta}, + + year={2024}, + + url = {https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md} + +} + +## Contributors + +Aaditya Singh; Aaron Grattafiori; Abhimanyu Dubey; Abhinav Jauhri; Abhinav Pandey; Abhishek Kadian; Adam Kelsey; Adi Gangidi; Ahmad Al-Dahle; Ahuva Goldstand; Aiesha Letman; Ajay Menon; Akhil Mathur; Alan Schelten; Alex Vaughan; Amy Yang; Andrei Lupu; Andres Alvarado; Andrew Gallagher; Andrew Gu; Andrew Ho; Andrew Poulton; Andrew Ryan; Angela Fan; Ankit Ramchandani; Anthony Hartshorn; Archi Mitra; Archie Sravankumar; Artem Korenev; Arun Rao; Ashley Gabriel; Ashwin Bharambe; Assaf Eisenman; Aston Zhang; Aurelien Rodriguez; Austen Gregerson; Ava Spataru; Baptiste Roziere; Ben Maurer; Benjamin Leonhardi; Bernie Huang; Bhargavi Paranjape; Bing Liu; Binh Tang; Bobbie Chern; Brani Stojkovic; Brian Fuller; Catalina Mejia Arenas; Chao Zhou; Charlotte Caucheteux; Chaya Nayak; Ching-Hsiang Chu; Chloe Bi; Chris Cai; Chris Cox; Chris Marra; Chris McConnell; Christian Keller; Christoph Feichtenhofer; Christophe Touret; Chunyang Wu; Corinne Wong; Cristian Canton Ferrer; Damien Allonsius; Daniel Kreymer; Daniel Haziza; Daniel Li; Danielle Pintz; Danny Livshits; Danny Wyatt; David Adkins; David Esiobu; David Xu; Davide Testuggine; Delia David; Devi Parikh; Dhruv Choudhary; Dhruv Mahajan; Diana Liskovich; Diego Garcia-Olano; Diego Perino; Dieuwke Hupkes; Dingkang Wang; Dustin Holland; Egor Lakomkin; Elina Lobanova; Xiaoqing Ellen Tan; Emily Dinan; Eric Smith; Erik Brinkman; Esteban Arcaute; Filip Radenovic; Firat Ozgenel; Francesco Caggioni; Frank Seide; Frank Zhang; Gabriel Synnaeve; Gabriella Schwarz; Gabrielle Lee; Gada Badeer; Georgia Anderson; Graeme Nail; Gregoire Mialon; Guan Pang; Guillem Cucurell; Hailey Nguyen; Hannah Korevaar; Hannah Wang; Haroun Habeeb; Harrison Rudolph; Henry Aspegren; Hu Xu; Hugo Touvron; Iga Kozlowska; Igor Molybog; Igor Tufanov; Iliyan Zarov; Imanol Arrieta Ibarra; Irina-Elena Veliche; Isabel Kloumann; Ishan Misra; Ivan Evtimov; Jacob Xu; Jade Copet; Jake Weissman; Jan Geffert; Jana Vranes; Japhet Asher; Jason Park; Jay Mahadeokar; Jean-Baptiste Gaya; Jeet Shah; Jelmer van der Linde; Jennifer Chan; Jenny Hong; Jenya Lee; Jeremy Fu; Jeremy Teboul; Jianfeng Chi; Jianyu Huang; Jie Wang; Jiecao Yu; Joanna Bitton; Joe Spisak; Joelle Pineau; Jon Carvill; Jongsoo Park; Joseph Rocca; Joshua Johnstun; Junteng Jia; Kalyan Vasuden Alwala; Kam Hou U; Kate Plawiak; Kartikeya Upasani; Kaushik Veeraraghavan; Ke Li; Kenneth Heafield; Kevin Stone; Khalid El-Arini; Krithika Iyer; Kshitiz Malik; Kuenley Chiu; Kunal Bhalla; Kyle Huang; Lakshya Garg; Lauren Rantala-Yeary; Laurens van der Maaten; Lawrence Chen; Leandro Silva; Lee Bell; Lei Zhang; Liang Tan; Louis Martin; Lovish Madaan; Luca Wehrstedt; Lukas Blecher; Luke de Oliveira; Madeline Muzzi; Madian Khabsa; Manav Avlani; Mannat Singh; Manohar Paluri; Mark Zuckerberg; Marcin Kardas; Martynas Mankus; Mathew Oldham; Mathieu Rita; Matthew Lennie; Maya Pavlova; Meghan Keneally; Melanie Kambadur; Mihir Patel; Mikayel Samvelyan; Mike Clark; Mike Lewis; Min Si; Mitesh Kumar Singh; Mo Metanat; Mona Hassan; Naman Goyal; Narjes Torabi; Nicolas Usunier; Nikolay Bashlykov; Nikolay Bogoychev; Niladri Chatterji; Ning Dong; Oliver Aobo Yang; Olivier Duchenne; Onur Celebi; Parth Parekh; Patrick Alrassy; Paul Saab; Pavan Balaji; Pedro Rittner; Pengchuan Zhang; Pengwei Li; Petar Vasic; Peter Weng; Polina Zvyagina; Prajjwal Bhargava; Pratik Dubal; Praveen Krishnan; Punit Singh Koura; Qing He; Rachel Rodriguez; Ragavan Srinivasan; Rahul Mitra; Ramon Calderer; Raymond Li; Robert Stojnic; Roberta Raileanu; Robin Battey; Rocky Wang; Rohit Girdhar; Rohit Patel; Romain Sauvestre; Ronnie Polidoro; Roshan Sumbaly; Ross Taylor; Ruan Silva; Rui Hou; Rui Wang; Russ Howes; Ruty Rinott; Saghar Hosseini; Sai Jayesh Bondu; Samyak Datta; Sanjay Singh; Sara Chugh; Sargun Dhillon; Satadru Pan; Sean Bell; Sergey Edunov; Shaoliang Nie; Sharan Narang; Sharath Raparthy; Shaun Lindsay; Sheng Feng; Sheng Shen; Shenghao Lin; Shiva Shankar; Shruti Bhosale; Shun Zhang; Simon Vandenhende; Sinong Wang; Seohyun Sonia Kim; Soumya Batra; Sten Sootla; Steve Kehoe; Suchin Gururangan; Sumit Gupta; Sunny Virk; Sydney Borodinsky; Tamar Glaser; Tamar Herman; Tamara Best; Tara Fowler; Thomas Georgiou; Thomas Scialom; Tianhe Li; Todor Mihaylov; Tong Xiao; Ujjwal Karn; Vedanuj Goswami; Vibhor Gupta; Vignesh Ramanathan; Viktor Kerkez; Vinay Satish Kumar; Vincent Gonguet; Vish Vogeti; Vlad Poenaru; Vlad Tiberiu Mihailescu; Vladan Petrovic; Vladimir Ivanov; Wei Li; Weiwei Chu; Wenhan Xiong; Wenyin Fu; Wes Bouaziz; Whitney Meers; Will Constable; Xavier Martinet; Xiaojian Wu; Xinbo Gao; Xinfeng Xie; Xuchao Jia; Yaelle Goldschlag; Yann LeCun; Yashesh Gaur; Yasmine Babaei; Ye Qi; Yenda Li; Yi Wen; Yiwen Song; Youngjin Nam; Yuchen Hao; Yuchen Zhang; Yun Wang; Yuning Mao; Yuzi He; Zacharie Delpierre Coudert; Zachary DeVito; Zahra Hankir; Zhaoduo Wen; Zheng Yan; Zhengxing Chen; Zhenyu Yang; Zoe Papakipos diff --git a/readme-cn.md b/readme-cn.md index 7afaa9e..228c03c 100644 --- a/readme-cn.md +++ b/readme-cn.md @@ -19,7 +19,7 @@ * [1. 加载模型](readme-cn.md#1-加载语言模型) * [2. 模型量化](readme-cn.md#2-模型量化) * [3. 模型微调](readme-cn.md#3-模型微调) - * [4. 提示词模版](readme-cn.md#4-提示词模版) + * [4. 角色扮演](readme-cn.md#4-角色扮演) * [辅助模型的功能](readme-cn.md#辅助模型的功能) * [1. 知识库检索](readme-cn.md#1-知识库检索) * [2. 代码解释器](readme-cn.md#2-代码解释器) @@ -31,6 +31,10 @@ ## 新特性更新日志 +- 🚀 2024-04-19更新日志 + 1. 支持模型Meta-Llama-3-8B和Meta-Llama-3-8B-Instruct。 + 2. 添加新特性“角色扮演”,可以让离线或者在线的模型扮演不同的角色。比如让语言模型扮演“英语翻译”,“面试官”,“小说家”,“产品经理”,“瑜伽师”等等,从而提供更加专业的回答。 + - 🚀 2024-04-15更新日志 1. 支持模型Orion-14B-Chat, Orion-14B-LongChat和Orion-14B-Chat-Int4。为了正确加载模型并推理,请先安装flash-attn库(目前这个库仅支持Linux和Windows) ```bash @@ -270,7 +274,7 @@ 4. **`特殊模型`** Huggingface上发布的量化模型(GGUF)或者需要特殊聊天模版的模型 5. **`在线模型`** 支持OpenAI和Google的在线语言模型,比如GPT4-Turbo和Gemini-Pro模型,或者在线的多模态模型GPT4-vision和Gemini-Pro-vision。需要提供OpenAI的API Key和Google API Key。可以在系统环境变量中配置OPENAI_API_KEY和GOOGLE_API_KEY,或者在配置界面中单独配置。 - `目前参数可以配置加载设备和加载位数,模型量化,模型微调,和提示词模版配置功能还未实现` + `目前参数可以配置加载设备和加载位数,模型量化,模型微调配置功能还未实现` ![Image1](./img/Configuration.png) @@ -397,9 +401,46 @@ 可以使用私有数据集,对语言模型进行微调。`该功能还未实现` - 4. **`提示词模版`** + 4. **`角色扮演`** + + 可以让离线或者在线的语言模型扮演不同的角色,从而提供更加专业的回答。 + + 支持英文和中文角色。 + + 目前支持的角色有: + + | 角色 | + | :---- | + |英语翻译专家| + |面试官| + |英语发音助手| + |旅游指南| + |广告商| + |讲故事者| + |脱口秀喜剧演员| + |辩手| + |编剧| + |小说家| + |影评人| + |诗人| + |说唱歌手| + |激励演讲者| + |数学教师| + |职业顾问| + |医生| + |牙医| + |厨师| + |汽车机械师| + |基于文本的冒险游戏| + |花哨标题生成器| + |瑜伽师| + |论文作家| + |美食评论家| + |机器学习工程师| + |正则表达式生成器| + |创业点子生成器| + |产品经理| - 给语言模型设置特殊情况下的提示词模版。`该功能还未实现` - ### 辅助模型的功能 diff --git a/readme.md b/readme.md index faebb65..a9743c5 100644 --- a/readme.md +++ b/readme.md @@ -19,7 +19,7 @@ The project inherits from the Langchain-Chatchat project(https://github.com/chat * [1. Load Model](readme.md#1-Load-Model) * [2. Quantization](readme.md#2-Quantization) * [3. Fine-tuning](readme.md#3-Fine-tuning) - * [4. Prompt Templates](readme.md#4-Prompt-Templates) + * [4. Role Play](readme.md#4-Role-Play) * [Auxiliary Model Features](readme.md#Auxiliary-Model-Features) * [1. Retrieval](readme.md#1-Retrieval) * [2. Code Interpreter](readme.md#2-Code-Interpreter) @@ -31,6 +31,10 @@ The project inherits from the Langchain-Chatchat project(https://github.com/chat ## New Feature Updates +- 🚀 Update Log for 2024-04-19 + 1. Support for models Meta-Llama-3-8B and Meta-Llama-3-8B-Instruct. + 2. Introduced a new feature called "Role-Playing," enabling offline or online models to take on different roles. For example, you can have the LLM Model role-play as an "English Translator," "Interviewer," "Novelist," "Product Manager," "Yogi" and more, thereby providing more specialized responses. + - 🚀 Update Log for 2024-04-15 1. Support for models Orion-14B-Chat, Orion-14B-LongChat and Orion-14B-Chat-Int4. To correctly load the model and perform inference, please install the `flash-attn` library (currently supported only on Linux and Windows). ```bash @@ -396,9 +400,46 @@ Auxiliary models, such as retrieval, code execution, text-to-speech, speech-to-t You can fine-tune the language model using a private dataset. `Not implemented` - 4. **`Prompt Templates`** + 4. **`Role Play`** + + You can have offline or online LLM Models play different roles to provide more professional responses. + + Support english and chinese roles. + + Currently supported roles include: + + | Role | + | :---- | + |English Translator| + |Interviewer| + |Spoken English Teacher| + |Travel Guide| + |Advertiser| + |Storyteller| + |Stand-up Comedian| + |Debater| + |Screenwriter| + |Novelist| + |Movie Critic| + |Poet| + |Rapper| + |Motivational Speaker| + |Math Teacher| + |Career Counselor| + |Doctor| + |Dentist| + |Chef| + |Automobile Mechanic| + |Text Based Adventure Game| + |Fancy Title Generator| + |Yogi| + |Essay Writer| + |Food Critic| + |Machine Learning Engineer| + |Regex Generator| + |Startup Idea Generator| + |Product Manager| - Set up a template for prompting the language model in specific scenarios. `Not implemented` - ### Auxiliary Model Features