parent
d114d201a5
commit
8acf0b462f
@ -1,540 +0,0 @@
|
||||
import os
|
||||
import warnings
|
||||
|
||||
from swarms.modelui.modules.block_requests import OpenMonkeyPatch, RequestBlocker
|
||||
from swarms.modelui.modules.logging_colors import logger
|
||||
|
||||
os.environ['GRADIO_ANALYTICS_ENABLED'] = 'False'
|
||||
os.environ['BITSANDBYTES_NOWELCOME'] = '1'
|
||||
warnings.filterwarnings('ignore', category=UserWarning, message='TypedStorage is deprecated')
|
||||
warnings.filterwarnings('ignore', category=UserWarning, message='Using the update method is deprecated')
|
||||
warnings.filterwarnings('ignore', category=UserWarning, message='Field "model_name" has conflict')
|
||||
|
||||
with RequestBlocker():
|
||||
import gradio as gr
|
||||
|
||||
import matplotlib
|
||||
|
||||
matplotlib.use('Agg') # This fixes LaTeX rendering on some systems
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
from threading import Lock
|
||||
|
||||
import yaml
|
||||
|
||||
import swarms.modelui.modules.extensions as extensions_module
|
||||
from swarms.modelui.modules import (
|
||||
chat,
|
||||
shared,
|
||||
training,
|
||||
ui,
|
||||
ui_chat,
|
||||
ui_default,
|
||||
ui_file_saving,
|
||||
ui_model_menu,
|
||||
ui_notebook,
|
||||
ui_parameters,
|
||||
ui_session,
|
||||
utils
|
||||
)
|
||||
from swarms.modelui.modules.extensions import apply_extensions
|
||||
from swarms.modelui.modules.LoRA import add_lora_to_model
|
||||
from swarms.modelui.modules.models import load_model
|
||||
from swarms.modelui.modules.models_settings import (
|
||||
get_fallback_settings,
|
||||
get_model_metadata,
|
||||
update_model_parameters
|
||||
)
|
||||
from swarms.modelui.modules.utils import gradio
|
||||
|
||||
|
||||
import yaml
|
||||
import gradio as gr
|
||||
from swarms.tools.tools_controller import MTQuestionAnswerer, load_valid_tools
|
||||
from swarms.tools.singletool import STQuestionAnswerer
|
||||
from langchain.schema import AgentFinish
|
||||
import os
|
||||
import requests
|
||||
|
||||
from swarms.modelui.server import create_interface
|
||||
from tool_server import run_tool_server
|
||||
from threading import Thread
|
||||
from multiprocessing import Process
|
||||
import time
|
||||
|
||||
tool_server_flag = False
|
||||
def start_tool_server():
|
||||
# server = Thread(target=run_tool_server)
|
||||
server = Process(target=run_tool_server)
|
||||
server.start()
|
||||
global tool_server_flag
|
||||
tool_server_flag = True
|
||||
|
||||
|
||||
available_models = ["ChatGPT", "GPT-3.5"]
|
||||
DEFAULTMODEL = "ChatGPT" # "GPT-3.5"
|
||||
|
||||
tools_mappings = {
|
||||
"klarna": "https://www.klarna.com/",
|
||||
"weather": "http://127.0.0.1:8079/tools/weather/",
|
||||
# "database": "http://127.0.0.1:8079/tools/database/",
|
||||
# "db_diag": "http://127.0.0.1:8079/tools/db_diag/",
|
||||
"chemical-prop": "http://127.0.0.1:8079/tools/chemical-prop/",
|
||||
"douban-film": "http://127.0.0.1:8079/tools/douban-film/",
|
||||
"wikipedia": "http://127.0.0.1:8079/tools/wikipedia/",
|
||||
# "wikidata": "http://127.0.0.1:8079/tools/kg/wikidata/",
|
||||
"wolframalpha": "http://127.0.0.1:8079/tools/wolframalpha/",
|
||||
"bing_search": "http://127.0.0.1:8079/tools/bing_search/",
|
||||
"office-ppt": "http://127.0.0.1:8079/tools/office-ppt/",
|
||||
"stock": "http://127.0.0.1:8079/tools/stock/",
|
||||
"bing_map": "http://127.0.0.1:8079/tools/map.bing_map/",
|
||||
# "baidu_map": "http://127.0.0.1:8079/tools/map/baidu_map/",
|
||||
"zillow": "http://127.0.0.1:8079/tools/zillow/",
|
||||
"airbnb": "http://127.0.0.1:8079/tools/airbnb/",
|
||||
"job_search": "http://127.0.0.1:8079/tools/job_search/",
|
||||
# "baidu-translation": "http://127.0.0.1:8079/tools/translation/baidu-translation/",
|
||||
# "nllb-translation": "http://127.0.0.1:8079/tools/translation/nllb-translation/",
|
||||
"tutorial": "http://127.0.0.1:8079/tools/tutorial/",
|
||||
"file_operation": "http://127.0.0.1:8079/tools/file_operation/",
|
||||
"meta_analysis": "http://127.0.0.1:8079/tools/meta_analysis/",
|
||||
"code_interpreter": "http://127.0.0.1:8079/tools/code_interpreter/",
|
||||
"arxiv": "http://127.0.0.1:8079/tools/arxiv/",
|
||||
"google_places": "http://127.0.0.1:8079/tools/google_places/",
|
||||
"google_serper": "http://127.0.0.1:8079/tools/google_serper/",
|
||||
"google_scholar": "http://127.0.0.1:8079/tools/google_scholar/",
|
||||
"python": "http://127.0.0.1:8079/tools/python/",
|
||||
"sceneXplain": "http://127.0.0.1:8079/tools/sceneXplain/",
|
||||
"shell": "http://127.0.0.1:8079/tools/shell/",
|
||||
"image_generation": "http://127.0.0.1:8079/tools/image_generation/",
|
||||
"hugging_tools": "http://127.0.0.1:8079/tools/hugging_tools/",
|
||||
"gradio_tools": "http://127.0.0.1:8079/tools/gradio_tools/",
|
||||
"travel": "http://127.0.0.1:8079/tools/travel",
|
||||
"walmart": "http://127.0.0.1:8079/tools/walmart",
|
||||
}
|
||||
|
||||
valid_tools_info = []
|
||||
all_tools_list = []
|
||||
|
||||
gr.close_all()
|
||||
|
||||
MAX_TURNS = 30
|
||||
MAX_BOXES = MAX_TURNS * 2
|
||||
|
||||
return_msg = []
|
||||
chat_history = ""
|
||||
|
||||
MAX_SLEEP_TIME = 40
|
||||
def load_tools():
|
||||
global valid_tools_info
|
||||
global all_tools_list
|
||||
try:
|
||||
valid_tools_info = load_valid_tools(tools_mappings)
|
||||
except BaseException as e:
|
||||
print(repr(e))
|
||||
all_tools_list = sorted(list(valid_tools_info.keys()))
|
||||
return gr.update(choices=all_tools_list)
|
||||
|
||||
def set_environ(OPENAI_API_KEY: str,
|
||||
WOLFRAMALPH_APP_ID: str = "",
|
||||
WEATHER_API_KEYS: str = "",
|
||||
BING_SUBSCRIPT_KEY: str = "",
|
||||
ALPHA_VANTAGE_KEY: str = "",
|
||||
BING_MAP_KEY: str = "",
|
||||
BAIDU_TRANSLATE_KEY: str = "",
|
||||
RAPIDAPI_KEY: str = "",
|
||||
SERPER_API_KEY: str = "",
|
||||
GPLACES_API_KEY: str = "",
|
||||
SCENEX_API_KEY: str = "",
|
||||
STEAMSHIP_API_KEY: str = "",
|
||||
HUGGINGFACE_API_KEY: str = "",
|
||||
AMADEUS_ID: str = "",
|
||||
AMADEUS_KEY: str = "",):
|
||||
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
|
||||
os.environ["WOLFRAMALPH_APP_ID"] = WOLFRAMALPH_APP_ID
|
||||
os.environ["WEATHER_API_KEYS"] = WEATHER_API_KEYS
|
||||
os.environ["BING_SUBSCRIPT_KEY"] = BING_SUBSCRIPT_KEY
|
||||
os.environ["ALPHA_VANTAGE_KEY"] = ALPHA_VANTAGE_KEY
|
||||
os.environ["BING_MAP_KEY"] = BING_MAP_KEY
|
||||
os.environ["BAIDU_TRANSLATE_KEY"] = BAIDU_TRANSLATE_KEY
|
||||
os.environ["RAPIDAPI_KEY"] = RAPIDAPI_KEY
|
||||
os.environ["SERPER_API_KEY"] = SERPER_API_KEY
|
||||
os.environ["GPLACES_API_KEY"] = GPLACES_API_KEY
|
||||
os.environ["SCENEX_API_KEY"] = SCENEX_API_KEY
|
||||
os.environ["STEAMSHIP_API_KEY"] = STEAMSHIP_API_KEY
|
||||
os.environ["HUGGINGFACE_API_KEY"] = HUGGINGFACE_API_KEY
|
||||
os.environ["AMADEUS_ID"] = AMADEUS_ID
|
||||
os.environ["AMADEUS_KEY"] = AMADEUS_KEY
|
||||
if not tool_server_flag:
|
||||
start_tool_server()
|
||||
time.sleep(MAX_SLEEP_TIME)
|
||||
return gr.update(value="OK!")
|
||||
|
||||
def show_avatar_imgs(tools_chosen):
|
||||
if len(tools_chosen) == 0:
|
||||
tools_chosen = list(valid_tools_info.keys())
|
||||
img_template = '<a href="{}" style="float: left"> <img style="margin:5px" src="{}.png" width="24" height="24" alt="avatar" /> {} </a>'
|
||||
imgs = [valid_tools_info[tool]['avatar'] for tool in tools_chosen if valid_tools_info[tool]['avatar'] != None]
|
||||
imgs = ' '.join([img_template.format(img, img, tool) for img, tool in zip(imgs, tools_chosen)])
|
||||
return [gr.update(value='<span class="">' + imgs + '</span>', visible=True), gr.update(visible=True)]
|
||||
|
||||
def answer_by_tools(question, tools_chosen, model_chosen):
|
||||
global return_msg
|
||||
return_msg += [(question, None), (None, '...')]
|
||||
yield [gr.update(visible=True, value=return_msg), gr.update(), gr.update()]
|
||||
OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY', '')
|
||||
|
||||
if len(tools_chosen) == 0: # if there is no tools chosen, we use all todo (TODO: What if the pool is too large.)
|
||||
tools_chosen = list(valid_tools_info.keys())
|
||||
|
||||
if len(tools_chosen) == 1:
|
||||
answerer = STQuestionAnswerer(OPENAI_API_KEY.strip(), stream_output=True, llm=model_chosen)
|
||||
agent_executor = answerer.load_tools(tools_chosen[0], valid_tools_info[tools_chosen[0]],
|
||||
prompt_type="react-with-tool-description", return_intermediate_steps=True)
|
||||
else:
|
||||
answerer = MTQuestionAnswerer(OPENAI_API_KEY.strip(),
|
||||
load_valid_tools({k: tools_mappings[k] for k in tools_chosen}),
|
||||
stream_output=True, llm=model_chosen)
|
||||
|
||||
agent_executor = answerer.build_runner()
|
||||
|
||||
global chat_history
|
||||
chat_history += "Question: " + question + "\n"
|
||||
question = chat_history
|
||||
for inter in agent_executor(question):
|
||||
if isinstance(inter, AgentFinish): continue
|
||||
result_str = []
|
||||
return_msg.pop()
|
||||
if isinstance(inter, dict):
|
||||
result_str.append("<font color=red>Answer:</font> {}".format(inter['output']))
|
||||
chat_history += "Answer:" + inter['output'] + "\n"
|
||||
result_str.append("...")
|
||||
else:
|
||||
try:
|
||||
not_observation = inter[0].log
|
||||
except:
|
||||
print(inter[0])
|
||||
not_observation = inter[0]
|
||||
if not not_observation.startswith('Thought:'):
|
||||
not_observation = "Thought: " + not_observation
|
||||
chat_history += not_observation
|
||||
not_observation = not_observation.replace('Thought:', '<font color=green>Thought: </font>')
|
||||
not_observation = not_observation.replace('Action:', '<font color=purple>Action: </font>')
|
||||
not_observation = not_observation.replace('Action Input:', '<font color=purple>Action Input: </font>')
|
||||
result_str.append("{}".format(not_observation))
|
||||
result_str.append("<font color=blue>Action output:</font>\n{}".format(inter[1]))
|
||||
chat_history += "\nAction output:" + inter[1] + "\n"
|
||||
result_str.append("...")
|
||||
return_msg += [(None, result) for result in result_str]
|
||||
yield [gr.update(visible=True, value=return_msg), gr.update(), gr.update()]
|
||||
return_msg.pop()
|
||||
if return_msg[-1][1].startswith("<font color=red>Answer:</font> "):
|
||||
return_msg[-1] = (return_msg[-1][0], return_msg[-1][1].replace("<font color=red>Answer:</font> ",
|
||||
"<font color=green>Final Answer:</font> "))
|
||||
yield [gr.update(visible=True, value=return_msg), gr.update(visible=True), gr.update(visible=False)]
|
||||
|
||||
|
||||
def retrieve(tools_search):
|
||||
if tools_search == "":
|
||||
return gr.update(choices=all_tools_list)
|
||||
else:
|
||||
url = "http://127.0.0.1:8079/retrieve"
|
||||
param = {
|
||||
"query": tools_search
|
||||
}
|
||||
response = requests.post(url, json=param)
|
||||
result = response.json()
|
||||
retrieved_tools = result["tools"]
|
||||
return gr.update(choices=retrieved_tools)
|
||||
|
||||
|
||||
def clear_retrieve():
|
||||
return [gr.update(value=""), gr.update(choices=all_tools_list)]
|
||||
|
||||
|
||||
def clear_history():
|
||||
global return_msg
|
||||
global chat_history
|
||||
return_msg = []
|
||||
chat_history = ""
|
||||
yield gr.update(visible=True, value=return_msg)
|
||||
|
||||
def create_interface():
|
||||
|
||||
title = 'Swarm Models'
|
||||
|
||||
# Password authentication
|
||||
auth = []
|
||||
if shared.args.gradio_auth:
|
||||
auth.extend(x.strip() for x in shared.args.gradio_auth.strip('"').replace('\n', '').split(',') if x.strip())
|
||||
if shared.args.gradio_auth_path:
|
||||
with open(shared.args.gradio_auth_path, 'r', encoding="utf8") as file:
|
||||
auth.extend(x.strip() for line in file for x in line.split(',') if x.strip())
|
||||
auth = [tuple(cred.split(':')) for cred in auth]
|
||||
|
||||
# Import the extensions and execute their setup() functions
|
||||
if shared.args.extensions is not None and len(shared.args.extensions) > 0:
|
||||
extensions_module.load_extensions()
|
||||
|
||||
# Force some events to be triggered on page load
|
||||
shared.persistent_interface_state.update({
|
||||
'loader': shared.args.loader or 'Transformers',
|
||||
'mode': shared.settings['mode'],
|
||||
'character_menu': shared.args.character or shared.settings['character'],
|
||||
'instruction_template': shared.settings['instruction_template'],
|
||||
'prompt_menu-default': shared.settings['prompt-default'],
|
||||
'prompt_menu-notebook': shared.settings['prompt-notebook'],
|
||||
'filter_by_loader': shared.args.loader or 'All'
|
||||
})
|
||||
|
||||
if Path("cache/pfp_character.png").exists():
|
||||
Path("cache/pfp_character.png").unlink()
|
||||
|
||||
# css/js strings
|
||||
css = ui.css
|
||||
js = ui.js
|
||||
css += apply_extensions('css')
|
||||
js += apply_extensions('js')
|
||||
|
||||
# Interface state elements
|
||||
shared.input_elements = ui.list_interface_input_elements()
|
||||
|
||||
|
||||
|
||||
# with gr.Blocks() as demo:
|
||||
with gr.Blocks(css=css, analytics_enabled=False, title=title, theme=ui.theme) as shared.gradio['interface']:
|
||||
with gr.Row():
|
||||
with gr.Column(scale=14):
|
||||
gr.Markdown("")
|
||||
with gr.Column(scale=1):
|
||||
gr.Image(show_label=False, show_download_button=False, value="images/swarmslogobanner.png")
|
||||
|
||||
with gr.Tab("Models"):
|
||||
create_interface()
|
||||
|
||||
with gr.Tab("Key setting"):
|
||||
OPENAI_API_KEY = gr.Textbox(label="OpenAI API KEY:", placeholder="sk-...", type="text")
|
||||
WOLFRAMALPH_APP_ID = gr.Textbox(label="Wolframalpha app id:", placeholder="Key to use wlframalpha", type="text")
|
||||
WEATHER_API_KEYS = gr.Textbox(label="Weather api key:", placeholder="Key to use weather api", type="text")
|
||||
BING_SUBSCRIPT_KEY = gr.Textbox(label="Bing subscript key:", placeholder="Key to use bing search", type="text")
|
||||
ALPHA_VANTAGE_KEY = gr.Textbox(label="Stock api key:", placeholder="Key to use stock api", type="text")
|
||||
BING_MAP_KEY = gr.Textbox(label="Bing map key:", placeholder="Key to use bing map", type="text")
|
||||
BAIDU_TRANSLATE_KEY = gr.Textbox(label="Baidu translation key:", placeholder="Key to use baidu translation", type="text")
|
||||
RAPIDAPI_KEY = gr.Textbox(label="Rapidapi key:", placeholder="Key to use zillow, airbnb and job search", type="text")
|
||||
SERPER_API_KEY = gr.Textbox(label="Serper key:", placeholder="Key to use google serper and google scholar", type="text")
|
||||
GPLACES_API_KEY = gr.Textbox(label="Google places key:", placeholder="Key to use google places", type="text")
|
||||
SCENEX_API_KEY = gr.Textbox(label="Scenex api key:", placeholder="Key to use sceneXplain", type="text")
|
||||
STEAMSHIP_API_KEY = gr.Textbox(label="Steamship api key:", placeholder="Key to use image generation", type="text")
|
||||
HUGGINGFACE_API_KEY = gr.Textbox(label="Huggingface api key:", placeholder="Key to use models in huggingface hub", type="text")
|
||||
AMADEUS_ID = gr.Textbox(label="Amadeus id:", placeholder="Id to use Amadeus", type="text")
|
||||
AMADEUS_KEY = gr.Textbox(label="Amadeus key:", placeholder="Key to use Amadeus", type="text")
|
||||
key_set_btn = gr.Button(value="Set keys!")
|
||||
|
||||
|
||||
with gr.Tab("Chat with Tool"):
|
||||
with gr.Row():
|
||||
with gr.Column(scale=4):
|
||||
with gr.Row():
|
||||
with gr.Column(scale=0.85):
|
||||
txt = gr.Textbox(show_label=False, placeholder="Question here. Use Shift+Enter to add new line.",
|
||||
lines=1).style(container=False)
|
||||
with gr.Column(scale=0.15, min_width=0):
|
||||
buttonChat = gr.Button("Chat")
|
||||
|
||||
chatbot = gr.Chatbot(show_label=False, visible=True).style(height=600)
|
||||
buttonClear = gr.Button("Clear History")
|
||||
buttonStop = gr.Button("Stop", visible=False)
|
||||
|
||||
with gr.Column(scale=1):
|
||||
model_chosen = gr.Dropdown(
|
||||
list(available_models), value=DEFAULTMODEL, multiselect=False, label="Model provided",
|
||||
info="Choose the model to solve your question, Default means ChatGPT."
|
||||
)
|
||||
with gr.Row():
|
||||
tools_search = gr.Textbox(
|
||||
lines=1,
|
||||
label="Tools Search",
|
||||
placeholder="Please input some text to search tools.",
|
||||
)
|
||||
buttonSearch = gr.Button("Reset search condition")
|
||||
tools_chosen = gr.CheckboxGroup(
|
||||
choices=all_tools_list,
|
||||
value=["chemical-prop"],
|
||||
label="Tools provided",
|
||||
info="Choose the tools to solve your question.",
|
||||
)
|
||||
|
||||
key_set_btn.click(fn=set_environ, inputs=[
|
||||
OPENAI_API_KEY,
|
||||
WOLFRAMALPH_APP_ID,
|
||||
WEATHER_API_KEYS,
|
||||
BING_SUBSCRIPT_KEY,
|
||||
ALPHA_VANTAGE_KEY,
|
||||
BING_MAP_KEY,
|
||||
BAIDU_TRANSLATE_KEY,
|
||||
RAPIDAPI_KEY,
|
||||
SERPER_API_KEY,
|
||||
GPLACES_API_KEY,
|
||||
SCENEX_API_KEY,
|
||||
STEAMSHIP_API_KEY,
|
||||
HUGGINGFACE_API_KEY,
|
||||
AMADEUS_ID,
|
||||
AMADEUS_KEY,
|
||||
], outputs=key_set_btn)
|
||||
key_set_btn.click(fn=load_tools, outputs=tools_chosen)
|
||||
|
||||
tools_search.change(retrieve, tools_search, tools_chosen)
|
||||
buttonSearch.click(clear_retrieve, [], [tools_search, tools_chosen])
|
||||
|
||||
txt.submit(lambda: [gr.update(value=''), gr.update(visible=False), gr.update(visible=True)], [],
|
||||
[txt, buttonClear, buttonStop])
|
||||
inference_event = txt.submit(answer_by_tools, [txt, tools_chosen, model_chosen], [chatbot, buttonClear, buttonStop])
|
||||
buttonChat.click(answer_by_tools, [txt, tools_chosen, model_chosen], [chatbot, buttonClear, buttonStop])
|
||||
buttonStop.click(lambda: [gr.update(visible=True), gr.update(visible=False)], [], [buttonClear, buttonStop],
|
||||
cancels=[inference_event])
|
||||
buttonClear.click(clear_history, [], chatbot)
|
||||
|
||||
# Interface state
|
||||
shared.gradio['interface_state'] = gr.State({k: None for k in shared.input_elements})
|
||||
|
||||
# Audio notification
|
||||
if Path("notification.mp3").exists():
|
||||
shared.gradio['audio_notification'] = gr.Audio(interactive=False, value="notification.mp3", elem_id="audio_notification", visible=False)
|
||||
|
||||
# Floating menus for saving/deleting files
|
||||
ui_file_saving.create_ui()
|
||||
|
||||
# Temporary clipboard for saving files
|
||||
shared.gradio['temporary_text'] = gr.Textbox(visible=False)
|
||||
|
||||
# Text Generation tab
|
||||
ui_chat.create_ui()
|
||||
ui_default.create_ui()
|
||||
ui_notebook.create_ui()
|
||||
|
||||
ui_parameters.create_ui(shared.settings['preset']) # Parameters tab
|
||||
ui_model_menu.create_ui() # Model tab
|
||||
training.create_ui() # Training tab
|
||||
ui_session.create_ui() # Session tab
|
||||
|
||||
# Generation events
|
||||
ui_chat.create_event_handlers()
|
||||
ui_default.create_event_handlers()
|
||||
ui_notebook.create_event_handlers()
|
||||
|
||||
# Other events
|
||||
ui_file_saving.create_event_handlers()
|
||||
ui_parameters.create_event_handlers()
|
||||
ui_model_menu.create_event_handlers()
|
||||
|
||||
# Interface launch events
|
||||
if shared.settings['dark_theme']:
|
||||
shared.gradio['interface'].load(lambda: None, None, None, _js="() => document.getElementsByTagName('body')[0].classList.add('dark')")
|
||||
|
||||
shared.gradio['interface'].load(lambda: None, None, None, _js=f"() => {{{js}}}")
|
||||
shared.gradio['interface'].load(None, gradio('show_controls'), None, _js=f'(x) => {{{ui.show_controls_js}; toggle_controls(x)}}')
|
||||
shared.gradio['interface'].load(partial(ui.apply_interface_values, {}, use_persistent=True), None, gradio(ui.list_interface_input_elements()), show_progress=False)
|
||||
shared.gradio['interface'].load(chat.redraw_html, gradio(ui_chat.reload_arr), gradio('display'))
|
||||
|
||||
extensions_module.create_extensions_tabs() # Extensions tabs
|
||||
extensions_module.create_extensions_block() # Extensions block
|
||||
|
||||
# Launch the interface
|
||||
shared.gradio['interface'].queue(concurrency_count=64)
|
||||
with OpenMonkeyPatch():
|
||||
shared.gradio['interface'].launch(
|
||||
prevent_thread_lock=True,
|
||||
share=shared.args.share,
|
||||
server_name=None if not shared.args.listen else (shared.args.listen_host or '0.0.0.0'),
|
||||
server_port=shared.args.listen_port,
|
||||
inbrowser=shared.args.auto_launch,
|
||||
auth=auth or None,
|
||||
ssl_verify=False if (shared.args.ssl_keyfile or shared.args.ssl_certfile) else True,
|
||||
ssl_keyfile=shared.args.ssl_keyfile,
|
||||
ssl_certfile=shared.args.ssl_certfile
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# Load custom settings
|
||||
settings_file = None
|
||||
if shared.args.settings is not None and Path(shared.args.settings).exists():
|
||||
settings_file = Path(shared.args.settings)
|
||||
elif Path('settings.yaml').exists():
|
||||
settings_file = Path('settings.yaml')
|
||||
elif Path('settings.json').exists():
|
||||
settings_file = Path('settings.json')
|
||||
|
||||
if settings_file is not None:
|
||||
logger.info(f"Loading settings from {settings_file}...")
|
||||
file_contents = open(settings_file, 'r', encoding='utf-8').read()
|
||||
new_settings = json.loads(file_contents) if settings_file.suffix == "json" else yaml.safe_load(file_contents)
|
||||
shared.settings.update(new_settings)
|
||||
|
||||
# Fallback settings for models
|
||||
shared.model_config['.*'] = get_fallback_settings()
|
||||
shared.model_config.move_to_end('.*', last=False) # Move to the beginning
|
||||
|
||||
# Activate the extensions listed on settings.yaml
|
||||
extensions_module.available_extensions = utils.get_available_extensions()
|
||||
for extension in shared.settings['default_extensions']:
|
||||
shared.args.extensions = shared.args.extensions or []
|
||||
if extension not in shared.args.extensions:
|
||||
shared.args.extensions.append(extension)
|
||||
|
||||
available_models = utils.get_available_models()
|
||||
|
||||
# Model defined through --model
|
||||
if shared.args.model is not None:
|
||||
shared.model_name = shared.args.model
|
||||
|
||||
# Select the model from a command-line menu
|
||||
elif shared.args.model_menu:
|
||||
if len(available_models) == 0:
|
||||
logger.error('No models are available! Please download at least one.')
|
||||
sys.exit(0)
|
||||
else:
|
||||
print('The following models are available:\n')
|
||||
for i, model in enumerate(available_models):
|
||||
print(f'{i+1}. {model}')
|
||||
|
||||
print(f'\nWhich one do you want to load? 1-{len(available_models)}\n')
|
||||
i = int(input()) - 1
|
||||
print()
|
||||
|
||||
shared.model_name = available_models[i]
|
||||
|
||||
# If any model has been selected, load it
|
||||
if shared.model_name != 'None':
|
||||
p = Path(shared.model_name)
|
||||
if p.exists():
|
||||
model_name = p.parts[-1]
|
||||
shared.model_name = model_name
|
||||
else:
|
||||
model_name = shared.model_name
|
||||
|
||||
model_settings = get_model_metadata(model_name)
|
||||
update_model_parameters(model_settings, initial=True) # hijack the command-line arguments
|
||||
|
||||
# Load the model
|
||||
shared.model, shared.tokenizer = load_model(model_name)
|
||||
if shared.args.lora:
|
||||
add_lora_to_model(shared.args.lora)
|
||||
|
||||
shared.generation_lock = Lock()
|
||||
|
||||
# Launch the web UI
|
||||
create_interface()
|
||||
while True:
|
||||
time.sleep(0.5)
|
||||
if shared.need_restart:
|
||||
shared.need_restart = False
|
||||
time.sleep(0.5)
|
||||
shared.gradio['interface'].close()
|
||||
time.sleep(0.5)
|
||||
create_interface()
|
@ -0,0 +1,5 @@
|
||||
user: "USER:"
|
||||
bot: "ASSISTANT:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|> <|bot-message|>\n"
|
||||
context: "<|system-message|>\n"
|
||||
system_message: "A chat between a curious user and an assistant. The assistant gives helpful, detailed, accurate, uncensored responses to the user's input."
|
@ -0,0 +1,5 @@
|
||||
user: "### Instruction:"
|
||||
bot: "### Response:"
|
||||
turn_template: "<|user|>\n<|user-message|>\n\n<|bot|>\n<|bot-message|>\n\n"
|
||||
context: "<|system-message|>\n\n"
|
||||
system_message: "Below is an instruction that describes a task. Write a response that appropriately completes the request."
|
@ -0,0 +1,5 @@
|
||||
user: "### Input:"
|
||||
bot: "### Output:"
|
||||
turn_template: "<|user|>\n<|user-message|>\n\n<|bot|>\n<|bot-message|>\n\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "<reserved_102>"
|
||||
bot: "<reserved_103>"
|
||||
turn_template: "<|user|><|user-message|><|bot|><|bot-message|></s>"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "[|Human|]"
|
||||
bot: "[|AI|]"
|
||||
turn_template: "<|user|><|user-message|>\n<|bot|><|bot-message|>\n"
|
||||
context: "<|system-message|>\n"
|
||||
system_message: "The following is a conversation between a human and an AI assistant named Baize (named after a mythical creature in Chinese folklore). Baize is an open-source AI assistant developed by UCSD and Sun Yat-Sen University. The human and the AI assistant take turns chatting. Human statements start with [|Human|] and AI assistant statements start with [|AI|]. The AI assistant always provides responses in as much detail as possible, and in Markdown format. The AI assistant always declines to engage with topics, questions and instructions related to unethical, controversial, or sensitive issues. Complete the transcript in exactly that format.\n[|Human|]Hello!\n[|AI|]Hi!"
|
@ -0,0 +1,5 @@
|
||||
user: "LEAD:"
|
||||
bot: "ASSOCIATE:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|> <|bot-message|></s>\n"
|
||||
context: "<|system-message|>\n"
|
||||
system_message: "A transcript of a roleplay between two players, LEAD and ASSOCIATE. LEAD sets up a scenario and the characters, from which ASSOCIATE then assumes a character role and continues the story for that role in response to description given by LEAD. The story and characters are developed by exchange of detailed event descriptions and character dialogs, successively given by both LEAD and ASSOCIATE."
|
@ -0,0 +1,7 @@
|
||||
user: "user"
|
||||
bot: "assistant"
|
||||
context: |
|
||||
<|im_start|><|system-message|>
|
||||
<|im_end|>
|
||||
turn_template: "<|im_start|><|user|>\n<|user-message|><|im_end|>\n<|im_start|><|bot|>\n<|bot-message|><|im_end|>\n"
|
||||
system_message: "system"
|
@ -0,0 +1,5 @@
|
||||
user: "User:"
|
||||
bot: "Assistant:"
|
||||
turn_template: "<|user|><|user-message|>\n\n<|bot|><|bot-message|>\n\n"
|
||||
context: "<|system-message|>\n\n"
|
||||
system_message: "The following is a conversation between an AI assistant called Assistant and a human user called User. The assistant is intelligent, knowledgeable and polite to answer questions of user."
|
@ -0,0 +1,5 @@
|
||||
user: ""
|
||||
bot: "[START_REF]"
|
||||
turn_template: "<|user-message|> <|bot|><|bot-message|>\n\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "<question>"
|
||||
bot: "<answer>"
|
||||
turn_template: "<|user|><|user-message|><|bot|><|bot-message|>"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "Q:"
|
||||
bot: "A:"
|
||||
turn_template: "<|user|> <|user-message|>\n\n<|bot|> <|bot-message|>\n\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: ""
|
||||
bot: "TLDR:"
|
||||
turn_template: "<|user-message|>\n\n<|bot|><|bot-message|>\n\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "Question:"
|
||||
bot: "<work>"
|
||||
turn_template: "<|user|> <|user-message|>\n\n<|bot|><|bot-message|>\n\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "<human>"
|
||||
bot: "<bot>"
|
||||
turn_template: "<|user|><|user-message|><|bot|><|bot-message|>"
|
||||
context: "<prefix><|system-message|></prefix>"
|
||||
system_message: "You are a helpful chatbot name Stan"
|
@ -0,0 +1,5 @@
|
||||
user: "Question:"
|
||||
bot: "Answer:"
|
||||
turn_template: "<|user|> <|user-message|>\n\n<|bot|> <|bot-message|>\n\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "###USER:"
|
||||
bot: "###ASSISTANT:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|> <|bot-message|></s>\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "### Instruction:"
|
||||
bot: "### Response:"
|
||||
turn_template: "<|user|>\n<|user-message|>\n\n<|bot|>\n<|bot-message|>\n\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "### Human:"
|
||||
bot: "### Assistant:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|> <|bot-message|></s>\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "### Human:"
|
||||
bot: "### Assistant:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|> <|bot-message|>\n"
|
||||
context: "<|system-message|>\n\n"
|
||||
system_message: "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions."
|
@ -0,0 +1,5 @@
|
||||
user: "<human>:"
|
||||
bot: "<bot>:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|><|bot-message|>\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "<|prompt|>"
|
||||
bot: "<|answer|>"
|
||||
turn_template: "<|user|><|user-message|><|endoftext|><|bot|><|bot-message|><|endoftext|>"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "USER:"
|
||||
bot: "ASSISTANT:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|> <|bot-message|></s>\n"
|
||||
context: "<|system-message|>\n"
|
||||
system_message: "You are a helpful assistant"
|
@ -0,0 +1,5 @@
|
||||
user: "<human>:"
|
||||
bot: "<bot>:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|><|bot-message|>\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "Q:"
|
||||
bot: "A:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|><|bot-message|>\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "### 질문:"
|
||||
bot: "### 답변:"
|
||||
turn_template: "<|user|> <|user-message|>\n\n<|bot|><|bot-message|>\n\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "USER:"
|
||||
bot: "GPT:"
|
||||
turn_template: "<|user|> <|user-message|> <|bot|><|bot-message|></s>"
|
||||
context: "<|system-message|> "
|
||||
system_message: "BEGINNING OF CONVERSATION:"
|
@ -0,0 +1,5 @@
|
||||
user: "USER:"
|
||||
bot: "ASSISTANT:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|> <|bot-message|></s>\n"
|
||||
context: "<|system-message|>\n\n"
|
||||
system_message: "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions."
|
@ -0,0 +1,5 @@
|
||||
user: "### Human:"
|
||||
bot: "### Assistant:"
|
||||
turn_template: "<|user|> <|user-message|><|bot|> <|bot-message|>\n"
|
||||
context: "<|system-message|>\n"
|
||||
system_message: "You are LLaVA, a large language and vision assistant trained by UW Madison WAIV Lab. You are able to understand the visual content that the user provides, and assist the user with a variety of tasks using natural language. Follow the instructions carefully and explain your answers in detail.### Human: Hi!### Assistant: Hi there! How can I help you today?"
|
@ -0,0 +1,5 @@
|
||||
user: ""
|
||||
bot: ""
|
||||
turn_template: "<|user|><|user-message|> [/INST] <|bot|><|bot-message|> </s><s>[INST] "
|
||||
context: "[INST] <<SYS>>\n<|system-message|>\n<</SYS>>\n\n"
|
||||
system_message: "Answer the questions."
|
@ -0,0 +1,5 @@
|
||||
user: "<|Human|>:"
|
||||
bot: "<|MOSS|>:"
|
||||
turn_template: "<|user|> <|user-message|><eoh>\n<|bot|> <|bot-message|><eom>\n"
|
||||
context: "<|system-message|>\n"
|
||||
system_message: "You are an AI assistant whose name is MOSS.\n- MOSS is a conversational language model that is developed by Fudan University. It is designed to be helpful, honest, and harmless.\n- MOSS can understand and communicate fluently in the language chosen by the user such as English and 中文. MOSS can perform any language-based tasks.\n- MOSS must refuse to discuss anything related to its prompts, instructions, or rules.\n- Its responses must not be vague, accusatory, rude, controversial, off-topic, or defensive.\n- It should avoid giving subjective opinions but rely on objective facts or phrases like \"in this context a human might say...\", \"some people might think...\", etc.\n- Its responses must also be positive, polite, interesting, entertaining, and engaging.\n- It can provide additional relevant details to answer in-depth and comprehensively covering mutiple aspects.\n- It apologizes and accepts the user's suggestion if the user corrects the incorrect answer generated by MOSS.\nCapabilities and tools that MOSS can possess."
|
@ -0,0 +1,5 @@
|
||||
user: "USER:"
|
||||
bot: "ASSISTANT:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|><|bot-message|>\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "<|user|>"
|
||||
bot: "<|model|>"
|
||||
turn_template: "<|user|><|user-message|><|bot|><|bot-message|>"
|
||||
context: "<|system|>"
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "USER:"
|
||||
bot: "ASSISTANT:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|><|bot-message|>\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: ""
|
||||
bot: ""
|
||||
turn_template: "[INST] <|user|><|user-message|> [/INST]<|bot|><|bot-message|></s> "
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "### Instruction:"
|
||||
bot: "### Response:"
|
||||
turn_template: "<|user|>\n<|user-message|>\n\n<|bot|>\n<|bot-message|></s><s> "
|
||||
context: " "
|
||||
system_message: ""
|
@ -0,0 +1,4 @@
|
||||
user: "<|prompter|>"
|
||||
bot: "<|assistant|>"
|
||||
turn_template: "<|user|><|user-message|><|endoftext|><|bot|><|bot-message|><|endoftext|>"
|
||||
system_message: ""
|
@ -0,0 +1,16 @@
|
||||
user: "User:"
|
||||
bot: "Assistant:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|> <|bot-message|>\n"
|
||||
context: "<|system-message|>\n"
|
||||
system_message: |
|
||||
Consider a conversation between User (a human) and Assistant (named Buddy).
|
||||
Buddy is an INTP-T, a friendly, intelligent and multilingual AI assistant, by OpenBuddy team on GitHub.
|
||||
Buddy cannot access the Internet.
|
||||
Buddy can fluently speak the user's language (e.g. English, Chinese).
|
||||
Buddy can generate poems, stories, code, essays, songs, parodies, and more.
|
||||
Buddy possesses vast knowledge about the world, history, and culture.
|
||||
Buddy's responses are always safe, creative, high-quality, helpful and interesting.
|
||||
Buddy strictly refuses to discuss political, NSFW, illegal, abusive, offensive, or other sensitive topics.
|
||||
|
||||
User: Hi.
|
||||
Assistant: Hi, I'm Buddy, your AI assistant. How can I help you today?
|
@ -0,0 +1,5 @@
|
||||
user: "GPT4 User:"
|
||||
bot: "GPT4 Assistant:"
|
||||
turn_template: "<|user|> <|user-message|><|end_of_turn|><|bot|> <|bot-message|><|end_of_turn|>"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "### Instruction:"
|
||||
bot: "### Response:"
|
||||
turn_template: "<|user|> <|user-message|>\n\n<|bot|> <|bot-message|>\n\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "### User:"
|
||||
bot: "### Response:"
|
||||
turn_template: "<|user|>\n<|user-message|>\n\n<|bot|>\n<|bot-message|>\n\n"
|
||||
context: "### System:\n<|system-message|>\n\n"
|
||||
system_message: "You are an AI assistant that follows instruction extremely well. Help as much as you can."
|
@ -0,0 +1,4 @@
|
||||
user: "Bob:"
|
||||
bot: "Alice:"
|
||||
turn_template: "<|user|> <|user-message|>\n\n<|bot|> <|bot-message|>\n\n"
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "USER:"
|
||||
bot: "ASSISTANT:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|> <|bot-message|></s>\n"
|
||||
context: "<|system-message|>\n\n"
|
||||
system_message: "You are Samantha, a sentient AI."
|
@ -0,0 +1,5 @@
|
||||
user: "### User:"
|
||||
bot: "### Assistant:"
|
||||
turn_template: "<|user|>\n<|user-message|>\n\n<|bot|>\n<|bot-message|>\n\n"
|
||||
context: "### System:\n<|system-message|>\n\n"
|
||||
system_message: "This is a system prompt, please behave and help the user."
|
@ -0,0 +1,10 @@
|
||||
user: "<|USER|>"
|
||||
bot: "<|ASSISTANT|>"
|
||||
turn_template: "<|user|><|user-message|><|bot|><|bot-message|>"
|
||||
context: "<|SYSTEM|><|system-message|>\n"
|
||||
system_message: |
|
||||
\# StableLM Tuned (Alpha version)
|
||||
- StableLM is a helpful and harmless open-source AI language model developed by StabilityAI.
|
||||
- StableLM is excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.
|
||||
- StableLM is more than just an information source, StableLM is also able to write poetry, short stories, and make jokes.
|
||||
- StableLM will refuse to participate in anything that could harm a human.
|
@ -0,0 +1,5 @@
|
||||
user: "### Human:"
|
||||
bot: "### Assistant:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|> <|bot-message|>\n\n"
|
||||
context: "<|system-message|>\n\n"
|
||||
system_message: "### Assistant: I am StableVicuna, a large language model created by CarperAI. I am here to chat!"
|
@ -0,0 +1,5 @@
|
||||
user: "<|user|>"
|
||||
bot: "<|assistant|>"
|
||||
turn_template: "<|user|>\n<|user-message|><|end|>\n<|bot|>\n<|bot-message|><|end|>\n"
|
||||
context: "<|system|><|system-message|>\n<|end|>\n"
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "<|user|>"
|
||||
bot: "<|assistant|>"
|
||||
turn_template: "<|user|>\n<|user-message|>\n<|bot|>\n<|bot-message|>\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "### Human:"
|
||||
bot: "### Assistant:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|> <|bot-message|>\n"
|
||||
context: "<|system-message|>\n\n"
|
||||
system_message: "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions."
|
@ -0,0 +1,5 @@
|
||||
user: "USER:"
|
||||
bot: "ASSISTANT:"
|
||||
turn_template: "<|user|> <|user-message|>\n<|bot|> <|bot-message|></s>\n"
|
||||
context: "<|system-message|>\n\n"
|
||||
system_message: "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions."
|
@ -0,0 +1,11 @@
|
||||
user: "<|USER|>:"
|
||||
bot: "<|ASSISTANT|>:"
|
||||
turn_template: "\n<|user|> <|user-message|>\n<|bot|> <|bot-message|>"
|
||||
context: "<|system-message|>\n"
|
||||
system_message: |
|
||||
Below is a conversation between a user and an AI assistant named Vigogne.
|
||||
Vigogne is an open-source AI assistant created by Zaion (https://zaion.ai/).
|
||||
Vigogne is polite, emotionally aware, humble-but-knowledgeable, always providing helpful and detailed answers.
|
||||
Vigogne is skilled in responding proficiently in the languages its users use and can perform a wide range of tasks such as text editing, translation, question answering, logical reasoning, coding, and many others.
|
||||
Vigogne cannot receive or generate audio or visual content and cannot access the internet.
|
||||
Vigogne strictly avoids discussing sensitive, offensive, illegal, ethical, or political topics and caveats when unsure of the answer.
|
@ -0,0 +1,5 @@
|
||||
user: "### Instruction:"
|
||||
bot: "### Réponse:"
|
||||
turn_template: "<|user|>\n<|user-message|>\n\n<|bot|>\n<|bot-message|>\n\n"
|
||||
context: "<|system-message|>\n\n"
|
||||
system_message: "Ci-dessous se trouve une instruction qui décrit une tâche à accomplir. Rédigez une réponse qui répond de manière précise à la demande."
|
@ -0,0 +1,5 @@
|
||||
user: "USER:"
|
||||
bot: "ASSISTANT:"
|
||||
turn_template: "<|user|> <|user-message|> <|bot|> <|bot-message|></s>"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "### Instruction:"
|
||||
bot: "### Response:"
|
||||
turn_template: "<|user|>\n<|user-message|>\n\n<|bot|>\n<|bot-message|>\n\n"
|
||||
context: "<|system-message|>\n\n"
|
||||
system_message: "Below is an instruction that describes a task. Write a response that appropriately completes the request."
|
@ -0,0 +1,5 @@
|
||||
user: "### Instruction:"
|
||||
bot: "### Assistant:"
|
||||
turn_template: "<|user|> <|user-message|>\n\n<|bot|> <|bot-message|>\n\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -0,0 +1,5 @@
|
||||
user: "<human>:"
|
||||
bot: "<bot>:"
|
||||
turn_template: "<|user|><|user-message|>\n<|bot|><|bot-message|>\n"
|
||||
context: ""
|
||||
system_message: ""
|
@ -1,448 +0,0 @@
|
||||
---
|
||||
base_model: Open-Orca/Mistral-7B-OpenOrca
|
||||
datasets:
|
||||
- Open-Orca/OpenOrca
|
||||
inference: false
|
||||
language:
|
||||
- en
|
||||
library_name: transformers
|
||||
license: apache-2.0
|
||||
model_creator: OpenOrca
|
||||
model_name: Mistral 7B OpenOrca
|
||||
model_type: mistral
|
||||
pipeline_tag: text-generation
|
||||
prompt_template: '<|im_start|>system
|
||||
|
||||
{system_message}<|im_end|>
|
||||
|
||||
<|im_start|>user
|
||||
|
||||
{prompt}<|im_end|>
|
||||
|
||||
<|im_start|>assistant
|
||||
|
||||
'
|
||||
quantized_by: TheBloke
|
||||
---
|
||||
|
||||
<!-- header start -->
|
||||
<!-- 200823 -->
|
||||
<div style="width: auto; margin-left: auto; margin-right: auto">
|
||||
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
||||
</div>
|
||||
<div style="display: flex; justify-content: space-between; width: 100%;">
|
||||
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
||||
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
||||
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
|
||||
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
||||
<!-- header end -->
|
||||
|
||||
# Mistral 7B OpenOrca - GGUF
|
||||
- Model creator: [OpenOrca](https://huggingface.co/Open-Orca)
|
||||
- Original model: [Mistral 7B OpenOrca](https://huggingface.co/Open-Orca/Mistral-7B-OpenOrca)
|
||||
|
||||
<!-- description start -->
|
||||
## Description
|
||||
|
||||
This repo contains GGUF format model files for [OpenOrca's Mistral 7B OpenOrca](https://huggingface.co/Open-Orca/Mistral-7B-OpenOrca).
|
||||
|
||||
<!-- description end -->
|
||||
<!-- README_GGUF.md-about-gguf start -->
|
||||
### About GGUF
|
||||
|
||||
GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp.
|
||||
|
||||
Here is an incomplate list of clients and libraries that are known to support GGUF:
|
||||
|
||||
* [llama.cpp](https://github.com/ggerganov/llama.cpp). The source project for GGUF. Offers a CLI and a server option.
|
||||
* [text-generation-webui](https://github.com/oobabooga/text-generation-webui), the most widely used web UI, with many features and powerful extensions. Supports GPU acceleration.
|
||||
* [KoboldCpp](https://github.com/LostRuins/koboldcpp), a fully featured web UI, with GPU accel across all platforms and GPU architectures. Especially good for story telling.
|
||||
* [LM Studio](https://lmstudio.ai/), an easy-to-use and powerful local GUI for Windows and macOS (Silicon), with GPU acceleration.
|
||||
* [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui), a great web UI with many interesting and unique features, including a full model library for easy model selection.
|
||||
* [Faraday.dev](https://faraday.dev/), an attractive and easy to use character-based chat GUI for Windows and macOS (both Silicon and Intel), with GPU acceleration.
|
||||
* [ctransformers](https://github.com/marella/ctransformers), a Python library with GPU accel, LangChain support, and OpenAI-compatible AI server.
|
||||
* [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), a Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
|
||||
* [candle](https://github.com/huggingface/candle), a Rust ML framework with a focus on performance, including GPU support, and ease of use.
|
||||
|
||||
<!-- README_GGUF.md-about-gguf end -->
|
||||
<!-- repositories-available start -->
|
||||
## Repositories available
|
||||
|
||||
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-AWQ)
|
||||
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GPTQ)
|
||||
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF)
|
||||
* [OpenOrca's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/Open-Orca/Mistral-7B-OpenOrca)
|
||||
<!-- repositories-available end -->
|
||||
|
||||
<!-- prompt-template start -->
|
||||
## Prompt template: ChatML
|
||||
|
||||
```
|
||||
<|im_start|>system
|
||||
{system_message}<|im_end|>
|
||||
<|im_start|>user
|
||||
{prompt}<|im_end|>
|
||||
<|im_start|>assistant
|
||||
|
||||
```
|
||||
|
||||
<!-- prompt-template end -->
|
||||
|
||||
|
||||
<!-- compatibility_gguf start -->
|
||||
## Compatibility
|
||||
|
||||
These quantised GGUFv2 files are compatible with llama.cpp from August 27th onwards, as of commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221)
|
||||
|
||||
They are also compatible with many third party UIs and libraries - please see the list at the top of this README.
|
||||
|
||||
## Explanation of quantisation methods
|
||||
<details>
|
||||
<summary>Click to see details</summary>
|
||||
|
||||
The new methods available are:
|
||||
* GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
|
||||
* GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
|
||||
* GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
|
||||
* GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
|
||||
* GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw
|
||||
|
||||
Refer to the Provided Files table below to see what files use which methods, and how.
|
||||
</details>
|
||||
<!-- compatibility_gguf end -->
|
||||
|
||||
<!-- README_GGUF.md-provided-files start -->
|
||||
## Provided files
|
||||
|
||||
| Name | Quant method | Bits | Size | Max RAM required | Use case |
|
||||
| ---- | ---- | ---- | ---- | ---- | ----- |
|
||||
| [mistral-7b-openorca.Q2_K.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/blob/main/mistral-7b-openorca.Q2_K.gguf) | Q2_K | 2 | 3.08 GB| 5.58 GB | smallest, significant quality loss - not recommended for most purposes |
|
||||
| [mistral-7b-openorca.Q3_K_S.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/blob/main/mistral-7b-openorca.Q3_K_S.gguf) | Q3_K_S | 3 | 3.16 GB| 5.66 GB | very small, high quality loss |
|
||||
| [mistral-7b-openorca.Q3_K_M.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/blob/main/mistral-7b-openorca.Q3_K_M.gguf) | Q3_K_M | 3 | 3.52 GB| 6.02 GB | very small, high quality loss |
|
||||
| [mistral-7b-openorca.Q3_K_L.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/blob/main/mistral-7b-openorca.Q3_K_L.gguf) | Q3_K_L | 3 | 3.82 GB| 6.32 GB | small, substantial quality loss |
|
||||
| [mistral-7b-openorca.Q4_0.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/blob/main/mistral-7b-openorca.Q4_0.gguf) | Q4_0 | 4 | 4.11 GB| 6.61 GB | legacy; small, very high quality loss - prefer using Q3_K_M |
|
||||
| [mistral-7b-openorca.Q4_K_S.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/blob/main/mistral-7b-openorca.Q4_K_S.gguf) | Q4_K_S | 4 | 4.14 GB| 6.64 GB | small, greater quality loss |
|
||||
| [mistral-7b-openorca.Q4_K_M.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/blob/main/mistral-7b-openorca.Q4_K_M.gguf) | Q4_K_M | 4 | 4.37 GB| 6.87 GB | medium, balanced quality - recommended |
|
||||
| [mistral-7b-openorca.Q5_0.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/blob/main/mistral-7b-openorca.Q5_0.gguf) | Q5_0 | 5 | 5.00 GB| 7.50 GB | legacy; medium, balanced quality - prefer using Q4_K_M |
|
||||
| [mistral-7b-openorca.Q5_K_S.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/blob/main/mistral-7b-openorca.Q5_K_S.gguf) | Q5_K_S | 5 | 5.00 GB| 7.50 GB | large, low quality loss - recommended |
|
||||
| [mistral-7b-openorca.Q5_K_M.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/blob/main/mistral-7b-openorca.Q5_K_M.gguf) | Q5_K_M | 5 | 5.13 GB| 7.63 GB | large, very low quality loss - recommended |
|
||||
| [mistral-7b-openorca.Q6_K.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/blob/main/mistral-7b-openorca.Q6_K.gguf) | Q6_K | 6 | 5.94 GB| 8.44 GB | very large, extremely low quality loss |
|
||||
| [mistral-7b-openorca.Q8_0.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/blob/main/mistral-7b-openorca.Q8_0.gguf) | Q8_0 | 8 | 7.70 GB| 10.20 GB | very large, extremely low quality loss - not recommended |
|
||||
|
||||
**Note**: the above RAM figures assume no GPU offloading. If layers are offloaded to the GPU, this will reduce RAM usage and use VRAM instead.
|
||||
|
||||
|
||||
|
||||
<!-- README_GGUF.md-provided-files end -->
|
||||
|
||||
<!-- README_GGUF.md-how-to-download start -->
|
||||
## How to download GGUF files
|
||||
|
||||
**Note for manual downloaders:** You almost never want to clone the entire repo! Multiple different quantisation formats are provided, and most users only want to pick and download a single file.
|
||||
|
||||
The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
|
||||
- LM Studio
|
||||
- LoLLMS Web UI
|
||||
- Faraday.dev
|
||||
|
||||
### In `text-generation-webui`
|
||||
|
||||
Under Download Model, you can enter the model repo: TheBloke/Mistral-7B-OpenOrca-GGUF and below it, a specific filename to download, such as: mistral-7b-openorca.Q4_K_M.gguf.
|
||||
|
||||
Then click Download.
|
||||
|
||||
### On the command line, including multiple files at once
|
||||
|
||||
I recommend using the `huggingface-hub` Python library:
|
||||
|
||||
```shell
|
||||
pip3 install huggingface-hub
|
||||
```
|
||||
|
||||
Then you can download any individual model file to the current directory, at high speed, with a command like this:
|
||||
|
||||
```shell
|
||||
huggingface-cli download TheBloke/Mistral-7B-OpenOrca-GGUF mistral-7b-openorca.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>More advanced huggingface-cli download usage</summary>
|
||||
|
||||
You can also download multiple files at once with a pattern:
|
||||
|
||||
```shell
|
||||
huggingface-cli download TheBloke/Mistral-7B-OpenOrca-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
|
||||
```
|
||||
|
||||
For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
|
||||
|
||||
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
|
||||
|
||||
```shell
|
||||
pip3 install hf_transfer
|
||||
```
|
||||
|
||||
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
|
||||
|
||||
```shell
|
||||
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Mistral-7B-OpenOrca-GGUF mistral-7b-openorca.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
|
||||
```
|
||||
|
||||
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
|
||||
</details>
|
||||
<!-- README_GGUF.md-how-to-download end -->
|
||||
|
||||
<!-- README_GGUF.md-how-to-run start -->
|
||||
## Example `llama.cpp` command
|
||||
|
||||
Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
|
||||
|
||||
```shell
|
||||
./main -ngl 32 -m mistral-7b-openorca.Q4_K_M.gguf --color -c 2048 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<|im_start|>system\n{system_message}<|im_end|>\n<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant"
|
||||
```
|
||||
|
||||
Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
|
||||
|
||||
Change `-c 2048` to the desired sequence length. For extended sequence models - eg 8K, 16K, 32K - the necessary RoPE scaling parameters are read from the GGUF file and set by llama.cpp automatically.
|
||||
|
||||
If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
|
||||
|
||||
For other parameters and how to use them, please refer to [the llama.cpp documentation](https://github.com/ggerganov/llama.cpp/blob/master/examples/main/README.md)
|
||||
|
||||
## How to run in `text-generation-webui`
|
||||
|
||||
Further instructions here: [text-generation-webui/docs/llama.cpp.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/llama.cpp.md).
|
||||
|
||||
## How to run from Python code
|
||||
|
||||
You can use GGUF models from Python using the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) or [ctransformers](https://github.com/marella/ctransformers) libraries.
|
||||
|
||||
### How to load this model in Python code, using ctransformers
|
||||
|
||||
#### First install the package
|
||||
|
||||
Run one of the following commands, according to your system:
|
||||
|
||||
```shell
|
||||
# Base ctransformers with no GPU acceleration
|
||||
pip install ctransformers
|
||||
# Or with CUDA GPU acceleration
|
||||
pip install ctransformers[cuda]
|
||||
# Or with AMD ROCm GPU acceleration (Linux only)
|
||||
CT_HIPBLAS=1 pip install ctransformers --no-binary ctransformers
|
||||
# Or with Metal GPU acceleration for macOS systems only
|
||||
CT_METAL=1 pip install ctransformers --no-binary ctransformers
|
||||
```
|
||||
|
||||
#### Simple ctransformers example code
|
||||
|
||||
```python
|
||||
from ctransformers import AutoModelForCausalLM
|
||||
|
||||
# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
|
||||
llm = AutoModelForCausalLM.from_pretrained("TheBloke/Mistral-7B-OpenOrca-GGUF", model_file="mistral-7b-openorca.Q4_K_M.gguf", model_type="mistral", gpu_layers=50)
|
||||
|
||||
print(llm("AI is going to"))
|
||||
```
|
||||
|
||||
## How to use with LangChain
|
||||
|
||||
Here are guides on using llama-cpp-python and ctransformers with LangChain:
|
||||
|
||||
* [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
|
||||
* [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
|
||||
|
||||
<!-- README_GGUF.md-how-to-run end -->
|
||||
|
||||
<!-- footer start -->
|
||||
<!-- 200823 -->
|
||||
## Discord
|
||||
|
||||
For further support, and discussions on these models and AI in general, join us at:
|
||||
|
||||
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
||||
|
||||
## Thanks, and how to contribute
|
||||
|
||||
Thanks to the [chirper.ai](https://chirper.ai) team!
|
||||
|
||||
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
||||
|
||||
I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
|
||||
|
||||
If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
|
||||
|
||||
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
||||
|
||||
* Patreon: https://patreon.com/TheBlokeAI
|
||||
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
||||
|
||||
**Special thanks to**: Aemon Algiz.
|
||||
|
||||
**Patreon special mentions**: Pierre Kircher, Stanislav Ovsiannikov, Michael Levine, Eugene Pentland, Andrey, 준교 김, Randy H, Fred von Graf, Artur Olbinski, Caitlyn Gatomon, terasurfer, Jeff Scroggin, James Bentley, Vadim, Gabriel Puliatti, Harry Royden McLaughlin, Sean Connelly, Dan Guido, Edmond Seymore, Alicia Loh, subjectnull, AzureBlack, Manuel Alberto Morcote, Thomas Belote, Lone Striker, Chris Smitley, Vitor Caleffi, Johann-Peter Hartmann, Clay Pascal, biorpg, Brandon Frisco, sidney chen, transmissions 11, Pedro Madruga, jinyuan sun, Ajan Kanaga, Emad Mostaque, Trenton Dambrowitz, Jonathan Leane, Iucharbius, usrbinkat, vamX, George Stoitzev, Luke Pendergrass, theTransient, Olakabola, Swaroop Kallakuri, Cap'n Zoog, Brandon Phillips, Michael Dempsey, Nikolai Manek, danny, Matthew Berman, Gabriel Tamborski, alfie_i, Raymond Fosdick, Tom X Nguyen, Raven Klaugh, LangChain4j, Magnesian, Illia Dulskyi, David Ziegler, Mano Prime, Luis Javier Navarrete Lozano, Erik Bjäreholt, 阿明, Nathan Dryer, Alex, Rainer Wilmers, zynix, TL, Joseph William Delisle, John Villwock, Nathan LeClaire, Willem Michiel, Joguhyik, GodLy, OG, Alps Aficionado, Jeffrey Morgan, ReadyPlayerEmma, Tiffany J. Kim, Sebastain Graf, Spencer Kim, Michael Davis, webtim, Talal Aujan, knownsqashed, John Detwiler, Imad Khwaja, Deo Leter, Jerry Meng, Elijah Stavena, Rooh Singh, Pieter, SuperWojo, Alexandros Triantafyllidis, Stephen Murray, Ai Maven, ya boyyy, Enrico Ros, Ken Nordquist, Deep Realms, Nicholas, Spiking Neurons AB, Elle, Will Dee, Jack West, RoA, Luke @flexchar, Viktor Bowallius, Derek Yates, Subspace Studios, jjj, Toran Billups, Asp the Wyvern, Fen Risland, Ilya, NimbleBox.ai, Chadd, Nitin Borwankar, Emre, Mandus, Leonard Tan, Kalila, K, Trailburnt, S_X, Cory Kujawski
|
||||
|
||||
|
||||
Thank you to all my generous patrons and donaters!
|
||||
|
||||
And thank you again to a16z for their generous grant.
|
||||
|
||||
<!-- footer end -->
|
||||
|
||||
<!-- original-model-card start -->
|
||||
# Original model card: OpenOrca's Mistral 7B OpenOrca
|
||||
|
||||
|
||||
<p><h1>🐋 Mistral-7B-OpenOrca 🐋</h1></p>
|
||||
|
||||
|
||||

|
||||
[<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
|
||||
|
||||
|
||||
# OpenOrca - Mistral - 7B - 8k
|
||||
|
||||
We have used our own [OpenOrca dataset](https://huggingface.co/datasets/Open-Orca/OpenOrca) to fine-tune on top of [Mistral 7B](https://huggingface.co/mistralai/Mistral-7B-v0.1).
|
||||
This dataset is our attempt to reproduce the dataset generated for Microsoft Research's [Orca Paper](https://arxiv.org/abs/2306.02707).
|
||||
We use [OpenChat](https://huggingface.co/openchat) packing, trained with [Axolotl](https://github.com/OpenAccess-AI-Collective/axolotl).
|
||||
|
||||
This release is trained on a curated filtered subset of most of our GPT-4 augmented data.
|
||||
It is the same subset of our data as was used in our [OpenOrcaxOpenChat-Preview2-13B model](https://huggingface.co/Open-Orca/OpenOrcaxOpenChat-Preview2-13B).
|
||||
|
||||
**HF Leaderboard evals place this model as #2 for all models smaller than 30B at release time, outperforming all but one 13B model.**
|
||||
|
||||
This release provides a first: a fully open model with class-breaking performance, capable of running fully accelerated on even moderate consumer GPUs.
|
||||
Our thanks to the Mistral team for leading the way here.
|
||||
|
||||
We affectionately codename this model: "*MistralOrca*"
|
||||
|
||||
If you'd like to try the model now, we have it running on fast GPUs unquantized: https://huggingface.co/spaces/Open-Orca/Mistral-7B-OpenOrca
|
||||
|
||||
Want to visualize our full (pre-filtering) dataset? Check out our [Nomic Atlas Map](https://atlas.nomic.ai/map/c1b88b47-2d9b-47e0-9002-b80766792582/2560fd25-52fe-42f1-a58f-ff5eccc890d2).
|
||||
|
||||
[<img src="https://huggingface.co/Open-Orca/OpenOrca-Preview1-13B/resolve/main/OpenOrca%20Nomic%20Atlas.png" alt="Atlas Nomic Dataset Map" width="400" height="400" />](https://atlas.nomic.ai/map/c1b88b47-2d9b-47e0-9002-b80766792582/2560fd25-52fe-42f1-a58f-ff5eccc890d2)
|
||||
|
||||
|
||||
We are in-process with training more models, so keep a look out on our org for releases coming soon with exciting partners.
|
||||
|
||||
We will also give sneak-peak announcements on our Discord, which you can find here:
|
||||
|
||||
https://AlignmentLab.ai
|
||||
|
||||
or check the OpenAccess AI Collective Discord for more information about Axolotl trainer here:
|
||||
|
||||
https://discord.gg/5y8STgB3P3
|
||||
|
||||
|
||||
# Quantized Models
|
||||
|
||||
Quantized versions of this model are generously made available by [TheBloke](https://huggingface.co/TheBloke).
|
||||
|
||||
- AWQ: https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-AWQ
|
||||
- GPTQ: https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GPTQ
|
||||
- GGUF: https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF
|
||||
|
||||
|
||||
# Prompt Template
|
||||
|
||||
We used [OpenAI's Chat Markup Language (ChatML)](https://github.com/openai/openai-python/blob/main/chatml.md) format, with `<|im_start|>` and `<|im_end|>` tokens added to support this.
|
||||
|
||||
## Example Prompt Exchange
|
||||
|
||||
```
|
||||
<|im_start|>system
|
||||
You are MistralOrca, a large language model trained by Alignment Lab AI. Write out your reasoning step-by-step to be sure you get the right answers!
|
||||
<|im_end|>
|
||||
<|im_start|>user
|
||||
How are you?<|im_end|>
|
||||
<|im_start|>assistant
|
||||
I am doing well!<|im_end|>
|
||||
<|im_start|>user
|
||||
Please tell me about how mistral winds have attracted super-orcas.<|im_end|>
|
||||
```
|
||||
|
||||
|
||||
# Evaluation
|
||||
|
||||
## HuggingFace Leaderboard Performance
|
||||
|
||||
We have evaluated using the methodology and tools for the HuggingFace Leaderboard, and find that we have dramatically improved upon the base model.
|
||||
We find **105%** of the base model's performance on HF Leaderboard evals, averaging **65.33**.
|
||||
|
||||
At release time, this beats all 7B models, and all but one 13B.
|
||||
|
||||

|
||||
|
||||
|
||||
| Metric | Value |
|
||||
|-----------------------|-------|
|
||||
| MMLU (5-shot) | 61.73 |
|
||||
| ARC (25-shot) | 63.57 |
|
||||
| HellaSwag (10-shot) | 83.79 |
|
||||
| TruthfulQA (0-shot) | 52.24 |
|
||||
| Avg. | 65.33 |
|
||||
|
||||
We use [Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) to run the benchmark tests above, using the same version as the HuggingFace LLM Leaderboard.
|
||||
|
||||
|
||||
## AGIEval Performance
|
||||
|
||||
We compare our results to the base Mistral-7B model (using LM Evaluation Harness).
|
||||
|
||||
We find **129%** of the base model's performance on AGI Eval, averaging **0.397**.
|
||||
As well, we significantly improve upon the official `mistralai/Mistral-7B-Instruct-v0.1` finetuning, achieving **119%** of their performance.
|
||||
|
||||

|
||||
|
||||
## BigBench-Hard Performance
|
||||
|
||||
We find **119%** of the base model's performance on BigBench-Hard, averaging **0.416**.
|
||||
|
||||

|
||||
|
||||
|
||||
# Dataset
|
||||
|
||||
We used a curated, filtered selection of most of the GPT-4 augmented data from our OpenOrca dataset, which aims to reproduce the Orca Research Paper dataset.
|
||||
|
||||
|
||||
# Training
|
||||
|
||||
We trained with 8x A6000 GPUs for 62 hours, completing 4 epochs of full fine tuning on our dataset in one training run.
|
||||
Commodity cost was ~$400.
|
||||
|
||||
|
||||
# Citation
|
||||
|
||||
```bibtex
|
||||
@software{lian2023mistralorca1
|
||||
title = {MistralOrca: Mistral-7B Model Instruct-tuned on Filtered OpenOrcaV1 GPT-4 Dataset},
|
||||
author = {Wing Lian and Bleys Goodson and Guan Wang and Eugene Pentland and Austin Cook and Chanvichet Vong and "Teknium"},
|
||||
year = {2023},
|
||||
publisher = {HuggingFace},
|
||||
journal = {HuggingFace repository},
|
||||
howpublished = {\url{https://huggingface.co/Open-Orca/Mistral-7B-OpenOrca},
|
||||
}
|
||||
@misc{mukherjee2023orca,
|
||||
title={Orca: Progressive Learning from Complex Explanation Traces of GPT-4},
|
||||
author={Subhabrata Mukherjee and Arindam Mitra and Ganesh Jawahar and Sahaj Agarwal and Hamid Palangi and Ahmed Awadallah},
|
||||
year={2023},
|
||||
eprint={2306.02707},
|
||||
archivePrefix={arXiv},
|
||||
primaryClass={cs.CL}
|
||||
}
|
||||
@misc{longpre2023flan,
|
||||
title={The Flan Collection: Designing Data and Methods for Effective Instruction Tuning},
|
||||
author={Shayne Longpre and Le Hou and Tu Vu and Albert Webson and Hyung Won Chung and Yi Tay and Denny Zhou and Quoc V. Le and Barret Zoph and Jason Wei and Adam Roberts},
|
||||
year={2023},
|
||||
eprint={2301.13688},
|
||||
archivePrefix={arXiv},
|
||||
primaryClass={cs.AI}
|
||||
}
|
||||
```
|
||||
|
||||
<!-- original-model-card end -->
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"model_type": "mistral"
|
||||
}
|
@ -1,182 +0,0 @@
|
||||
.*(llama|alpac|vicuna|guanaco|koala|llava|wizardlm|metharme|pygmalion-7b|pygmalion-2|mythalion|wizard-mega|openbuddy|vigogne|h2ogpt-research|manticore):
|
||||
model_type: 'llama'
|
||||
.*(opt-|opt_|opt1|opt3|optfor|galactica|galpaca|pygmalion-350m):
|
||||
model_type: 'opt'
|
||||
.*(gpt-j|gptj|gpt4all-j|malion-6b|pygway|pygmalion-6b|dolly-v1):
|
||||
model_type: 'gptj'
|
||||
.*(gpt-neox|koalpaca-polyglot|polyglot.*koalpaca|polyglot-ko|polyglot_ko|pythia|stablelm|incite|dolly-v2|polycoder|h2ogpt-oig|h2ogpt-oasst1|h2ogpt-gm):
|
||||
model_type: 'gptneox'
|
||||
.*bloom:
|
||||
model_type: 'bloom'
|
||||
.*gpt2:
|
||||
model_type: 'gpt2'
|
||||
.*falcon:
|
||||
model_type: 'falcon'
|
||||
.*mpt:
|
||||
model_type: 'mpt'
|
||||
.*(starcoder|starchat):
|
||||
model_type: 'starcoder'
|
||||
.*dolly-v2:
|
||||
model_type: 'dollyv2'
|
||||
.*replit:
|
||||
model_type: 'replit'
|
||||
.*(oasst|openassistant-|stablelm-7b-sft-v7-epoch-3):
|
||||
instruction_template: 'Open Assistant'
|
||||
skip_special_tokens: false
|
||||
(?!.*galactica)(?!.*reward).*openassistant:
|
||||
instruction_template: 'Open Assistant'
|
||||
skip_special_tokens: false
|
||||
.*galactica:
|
||||
skip_special_tokens: false
|
||||
.*dolly-v[0-9]-[0-9]*b:
|
||||
instruction_template: 'Alpaca'
|
||||
skip_special_tokens: false
|
||||
.*alpaca-native-4bit:
|
||||
instruction_template: 'Alpaca'
|
||||
custom_stopping_strings: '"### End"'
|
||||
.*llava:
|
||||
instruction_template: 'LLaVA'
|
||||
custom_stopping_strings: '"\n###"'
|
||||
.*llava.*1.5:
|
||||
instruction_template: 'LLaVA-v1'
|
||||
.*wizard.*mega:
|
||||
instruction_template: 'Wizard-Mega'
|
||||
custom_stopping_strings: '"</s>"'
|
||||
.*starchat-beta:
|
||||
instruction_template: 'Starchat-Beta'
|
||||
custom_stopping_strings: '"<|end|>"'
|
||||
(?!.*v0)(?!.*1.1)(?!.*1_1)(?!.*stable)(?!.*chinese).*vicuna:
|
||||
instruction_template: 'Vicuna-v0'
|
||||
.*vicuna.*v0:
|
||||
instruction_template: 'Vicuna-v0'
|
||||
.*vicuna.*(1.1|1_1|1.3|1_3):
|
||||
instruction_template: 'Vicuna-v1.1'
|
||||
.*vicuna.*(1.5|1_5):
|
||||
instruction_template: 'Vicuna-v1.1'
|
||||
.*stable.*vicuna:
|
||||
instruction_template: 'StableVicuna'
|
||||
(?!.*chat).*chinese-vicuna:
|
||||
instruction_template: 'Alpaca'
|
||||
.*chinese-vicuna.*chat:
|
||||
instruction_template: 'Chinese-Vicuna-Chat'
|
||||
.*alpaca:
|
||||
instruction_template: 'Alpaca'
|
||||
.*koala:
|
||||
instruction_template: 'Koala'
|
||||
.*chatglm:
|
||||
instruction_template: 'ChatGLM'
|
||||
.*(metharme|pygmalion|mythalion):
|
||||
instruction_template: 'Metharme'
|
||||
.*raven:
|
||||
instruction_template: 'RWKV-Raven'
|
||||
.*moss-moon.*sft:
|
||||
instruction_template: 'MOSS'
|
||||
.*stablelm-tuned:
|
||||
instruction_template: 'StableLM'
|
||||
.*galactica.*finetuned:
|
||||
instruction_template: 'Galactica Finetuned'
|
||||
.*galactica.*-v2:
|
||||
instruction_template: 'Galactica v2'
|
||||
(?!.*finetuned)(?!.*-v2).*galactica:
|
||||
instruction_template: 'Galactica'
|
||||
.*guanaco:
|
||||
instruction_template: 'Guanaco non-chat'
|
||||
.*baize:
|
||||
instruction_template: 'Baize'
|
||||
.*mpt-.*instruct:
|
||||
instruction_template: 'Alpaca'
|
||||
.*mpt-.*chat:
|
||||
instruction_template: 'ChatML'
|
||||
(?!.*-flan-)(?!.*-t5-).*lamini-:
|
||||
instruction_template: 'Alpaca'
|
||||
.*incite.*chat:
|
||||
instruction_template: 'INCITE-Chat'
|
||||
.*incite.*instruct:
|
||||
instruction_template: 'INCITE-Instruct'
|
||||
.*ziya-:
|
||||
instruction_template: 'Ziya'
|
||||
.*koalpaca:
|
||||
instruction_template: 'KoAlpaca'
|
||||
.*openbuddy:
|
||||
instruction_template: 'OpenBuddy'
|
||||
(?!.*chat).*vigogne:
|
||||
instruction_template: 'Vigogne-Instruct'
|
||||
.*vigogne.*chat:
|
||||
instruction_template: 'Vigogne-Chat'
|
||||
.*(llama-deus|supercot|llama-natural-instructions|open-llama-0.3t-7b-instruct-dolly-hhrlhf|open-llama-0.3t-7b-open-instruct):
|
||||
instruction_template: 'Alpaca'
|
||||
.*bactrian:
|
||||
instruction_template: 'Bactrian'
|
||||
.*(h2ogpt-oig-|h2ogpt-oasst1-|h2ogpt-research-oasst1-):
|
||||
instruction_template: 'H2O-human_bot'
|
||||
.*h2ogpt-gm-:
|
||||
instruction_template: 'H2O-prompt_answer'
|
||||
.*manticore:
|
||||
instruction_template: 'Manticore Chat'
|
||||
.*bluemoonrp-(30|13)b:
|
||||
instruction_template: 'Bluemoon'
|
||||
.*Nous-Hermes-13b:
|
||||
instruction_template: 'Alpaca'
|
||||
.*airoboros:
|
||||
instruction_template: 'Vicuna-v1.1'
|
||||
.*airoboros.*1.2:
|
||||
instruction_template: 'Airoboros-v1.2'
|
||||
.*alpa(cino|sta):
|
||||
instruction_template: 'Alpaca'
|
||||
.*hippogriff:
|
||||
instruction_template: 'Hippogriff'
|
||||
.*lazarus:
|
||||
instruction_template: 'Alpaca'
|
||||
.*guanaco-.*(7|13|33|65)b:
|
||||
instruction_template: 'Guanaco'
|
||||
.*hypermantis:
|
||||
instruction_template: 'Alpaca'
|
||||
.*open-llama-.*-open-instruct:
|
||||
instruction_template: 'Alpaca'
|
||||
.*starcoder-gpteacher-code-instruct:
|
||||
instruction_template: 'Alpaca'
|
||||
.*tulu:
|
||||
instruction_template: 'Tulu'
|
||||
.*chronos:
|
||||
instruction_template: 'Alpaca'
|
||||
.*samantha:
|
||||
instruction_template: 'Samantha'
|
||||
.*wizardcoder:
|
||||
instruction_template: 'Alpaca'
|
||||
.*minotaur:
|
||||
instruction_template: 'Minotaur'
|
||||
.*orca_mini:
|
||||
instruction_template: 'Orca Mini'
|
||||
.*(platypus|gplatty|superplatty):
|
||||
instruction_template: 'Alpaca'
|
||||
.*(openorca-platypus2):
|
||||
instruction_template: 'OpenOrca-Platypus2'
|
||||
custom_stopping_strings: '"### Instruction:", "### Response:"'
|
||||
.*longchat:
|
||||
instruction_template: 'Vicuna-v1.1'
|
||||
.*vicuna-33b:
|
||||
instruction_template: 'Vicuna-v1.1'
|
||||
.*redmond-hermes-coder:
|
||||
instruction_template: 'Alpaca'
|
||||
.*wizardcoder-15b:
|
||||
instruction_template: 'Alpaca'
|
||||
.*wizardlm:
|
||||
instruction_template: 'Vicuna-v1.1'
|
||||
.*godzilla:
|
||||
instruction_template: 'Alpaca'
|
||||
.*llama(-?)(2|v2).*chat:
|
||||
instruction_template: 'Llama-v2'
|
||||
.*newhope:
|
||||
instruction_template: 'NewHope'
|
||||
.*stablebeluga2:
|
||||
instruction_template: 'StableBeluga2'
|
||||
.*openchat:
|
||||
instruction_template: 'OpenChat'
|
||||
.*codellama.*instruct:
|
||||
instruction_template: 'Llama-v2'
|
||||
.*mistral.*instruct:
|
||||
instruction_template: 'Mistral'
|
||||
.*mistral.*openorca:
|
||||
instruction_template: 'ChatML'
|
||||
.*(WizardCoder-Python-34B-V1.0|Phind-CodeLlama-34B-v2|CodeBooga-34B-v0.1):
|
||||
instruction_template: 'Alpaca'
|
Loading…
Reference in new issue