Create genparam.py
Browse files- genparam.py +50 -0
genparam.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from secretsload import load_stsecrets
|
| 3 |
+
|
| 4 |
+
credentials = load_stsecrets()
|
| 5 |
+
|
| 6 |
+
# Model Configuration
|
| 7 |
+
ACTIVE_MODEL = 0 # 0 == SELECTED_MODEL_1 and PROMPT_TEMPLATE_1
|
| 8 |
+
ACTIVE_INDEX = 0 # 0 == VECTOR_INDEX_1
|
| 9 |
+
|
| 10 |
+
TYPE = "chat" # so that it uses the chat history
|
| 11 |
+
SELECTED_MODEL_1 = "meta-llama/llama-3-1-70b-instruct"
|
| 12 |
+
SELECTED_MODEL_2 = "mistralai/mistral-large"
|
| 13 |
+
# Pick a model_id, you can find them here https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-api-model-ids.html?context=wx&audience=wdp or switch between the two options up there by adjusting the ACTIVE_MODEL variable between 0 (1) and 1 (2).
|
| 14 |
+
VERIFY = False
|
| 15 |
+
|
| 16 |
+
# Prompt Configuration
|
| 17 |
+
PROMPT_TEMPLATE_1 = "llama3-instruct (llama-3, 3.1 & 3.2) - system"
|
| 18 |
+
PROMPT_TEMPLATE_2 = "mistral & mixtral v2 tokenizer - system segmented"
|
| 19 |
+
# <pick prompt template from model_family_syntax below> For example "llama3-instruct (llama-3 & 3.1) - user" if you don't use a system prompt.
|
| 20 |
+
BAKE_IN_PROMPT_SYNTAX = True
|
| 21 |
+
|
| 22 |
+
# Bot Names
|
| 23 |
+
BOT_1_NAME = "PATH-er B."
|
| 24 |
+
BOT_2_NAME = "MOD-ther S."
|
| 25 |
+
BOT_3_NAME = "SYS-ter V."
|
| 26 |
+
|
| 27 |
+
# Bot Prompts
|
| 28 |
+
|
| 29 |
+
BOT_1_PROMPT = str(st.secrets["system_prompt_1"])
|
| 30 |
+
BOT_2_PROMPT = str(st.secrets["system_prompt_2"])
|
| 31 |
+
BOT_3_PROMPT = str(st.secrets["system_prompt_3"])
|
| 32 |
+
|
| 33 |
+
# Vector Indexes
|
| 34 |
+
VECTOR_INDEX_1 = str(st.secrets["vector_index_id_1"])
|
| 35 |
+
VECTOR_INDEX_2 = str(st.secrets["vector_index_id_2"])
|
| 36 |
+
|
| 37 |
+
# Generation Parameters
|
| 38 |
+
DECODING_METHOD = "greedy" # greedy or sample
|
| 39 |
+
MAX_NEW_TOKENS = 850
|
| 40 |
+
MIN_NEW_TOKENS = 1
|
| 41 |
+
REPETITION_PENALTY = 1.0
|
| 42 |
+
STOP_SEQUENCES = ["<|end_of_text|>","</s>"] # This one is set up for llama models, if you use mistral </s> is the preferred stop_sequence
|
| 43 |
+
|
| 44 |
+
# Additional Parameters - Only active if you pick sampling in decoding method
|
| 45 |
+
TEMPERATURE = 0.7
|
| 46 |
+
TOP_P = 1.0
|
| 47 |
+
TOP_K = 50
|
| 48 |
+
|
| 49 |
+
DISPLAY_CHAT_HISTORY = 1 # 0 to not display chat history, 1 to display chat history
|
| 50 |
+
TOKEN_CAPTURE_ENABLED = 0 # Set to 1 to enable token capture preview in the side_bar, 0 to disable
|