Skip to content

Commit

Permalink
refactor: 모델 이름 일괄 변경
Browse files Browse the repository at this point in the history
- gpt-3.5-turbo-16k -> gpt-4o-mini

#41
  • Loading branch information
kooqooo committed Aug 8, 2024
1 parent e854b6c commit 007d67c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 18 deletions.
4 changes: 1 addition & 3 deletions pages/3_gene_question.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from src.rule_based import list_extend_questions_based_on_keywords
from src.util import local_css, read_prompt_from_txt
from src.semantic_search import faiss_inference, reranker
from config import OPENAI_API_KEY, DATA_DIR, IMG_PATH, CSS_PATH, PORT
from config import OPENAI_API_KEY, DATA_DIR, IMG_PATH, CSS_PATH, PORT, MODEL_NAME

st.session_state["FAV_IMAGE_PATH"] = os.path.join(IMG_PATH, "favicon.png")
st.set_page_config(
Expand Down Expand Up @@ -80,8 +80,6 @@
</style>
""",unsafe_allow_html=True)

## set variables
MODEL_NAME = "gpt-3.5-turbo-16k"

## set save dir
USER_RESUME_SAVE_DIR = os.path.join(st.session_state["save_dir"], "2_generate_question_user_resume.pdf")
Expand Down
4 changes: 1 addition & 3 deletions pages/3_gene_question_no_resume.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from src.rule_based import list_extend_questions_based_on_keywords
from src.util import local_css, read_prompt_from_txt
from src.semantic_search import faiss_inference, reranker
from config import OPENAI_API_KEY, DATA_DIR, IMG_PATH, CSS_PATH, PORT
from config import OPENAI_API_KEY, DATA_DIR, IMG_PATH, CSS_PATH, MODEL_NAME

st.session_state["FAV_IMAGE_PATH"] = os.path.join(IMG_PATH, "favicon.png")
st.set_page_config(
Expand Down Expand Up @@ -81,8 +81,6 @@
</style>
""",unsafe_allow_html=True)

## set variables
MODEL_NAME = "gpt-3.5-turbo-16k"

## set save dir
USER_RESUME_SAVE_DIR = os.path.join(st.session_state["save_dir"], "2_generate_question_user_resume.pdf")
Expand Down
4 changes: 1 addition & 3 deletions pages/4_show_questions_hint.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from src.generate_question import (create_prompt_feedback, # 추가
create_prompt_hint)
from src.util import read_prompt_from_txt
from config import DATA_DIR, IMG_PATH, OPENAI_API_KEY
from config import DATA_DIR, IMG_PATH, OPENAI_API_KEY, MODEL_NAME

st.session_state["FAV_IMAGE_PATH"] = os.path.join(IMG_PATH, "favicon.png")
st.set_page_config(
Expand All @@ -23,8 +23,6 @@
layout="wide",
initial_sidebar_state="collapsed",
)
#MODEL_NAME = "gpt-4-0125-preview"
MODEL_NAME = "gpt-3.5-turbo-16k"
NEXT_PAGE = "introduction"

st.session_state.logger.info("start show_questions page")
Expand Down
9 changes: 2 additions & 7 deletions src/gene_question_2chain_ver.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from streamlit_extras.switch_page_button import switch_page
from util import local_css, read_prompt_from_txt

from config import OPENAI_API_KEY # OPENAI_API_KEY 불러오기
from config import OPENAI_API_KEY, MODEL_NAME

DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data")
st.session_state["FAV_IMAGE_PATH"] = os.path.join(DATA_DIR, "images/favicon.png")
Expand Down Expand Up @@ -109,9 +109,6 @@
# """,
unsafe_allow_html=True,)

## set variables
MODEL_NAME = "gpt-3.5-turbo-16k"

## set save dir
USER_RESUME_SAVE_DIR = os.path.join(st.session_state["save_dir"], "2_generate_question_user_resume.pdf")
### 추가
Expand Down Expand Up @@ -191,9 +188,7 @@
st.session_state.logger.info("create prompt JD object")

### 모델 세팅 그대로
llm = ChatOpenAI(
temperature=st.session_state.temperature, model_name=MODEL_NAME, openai_api_key=OPENAI_API_KEY
)
llm = ChatOpenAI(temperature=st.session_state.temperature, model_name=MODEL_NAME)

st.session_state.logger.info("create llm object")

Expand Down
2 changes: 1 addition & 1 deletion src/make_faiss_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
data = pd.read_csv('hellojobits_tag.csv')
data = data.iloc[:,0].tolist()

model_name = "sentence-transformers/distiluse-base-multilingual-cased-v2"
model_name = "jhgan/ko-sroberta-multitask"
model_kwargs = {'device': 'cuda'}
encode_kwargs = {'normalize_embeddings': True} # set True to compute cosine similarity
model_norm = HuggingFaceEmbeddings(
Expand Down
2 changes: 1 addition & 1 deletion src/semantic_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def faiss_inference(query):
output으로는 (4 * 키워드 줄 개수 - 중복된 문장)개의 질문이 반환됩니다
'''
embeddings = HuggingFaceEmbeddings(
model_name = "sentence-transformers/distiluse-base-multilingual-cased-v2",
model_name = "BM-K/KoSimCSE-roberta-multitask",
model_kwargs = {'device': 'cuda'}
)
store_name="./FAISS_INDEX_TAG"
Expand Down

0 comments on commit 007d67c

Please sign in to comment.