목록Project/LLM (14)
무제
판례 json 데이터가 5만 여개가 넘고, 각 데이터를 하나의 CSV로 처리하여 관리하고 싶었다. 나중에는 db를 활용해야겠지만, 현재는 판례 데이터를 병합하여 하나의 데이터프레임으로 만들어 로컬에서 관리할 것이다. 이를 위해 json을 읽고 데이터프레임으로 빠르게 변환하는 방법인 dask를 사용하였다. import dask.bag as dbimport jsonimport globdirectory_path = "./1.판례"json_files = glob.glob(f"{directory_path}/*.json")bag = db.from_sequence(json_files)def load_json(file_path): with open(file_path, 'r', encoding='utf-8') a..
1. LLM 커리큘럼 https://fastcampus.co.kr/data_online_rag RAG를 활용한 완성도 높은 LLM 서비스 구축 With langchain & llamaindex | 패스트캠퍼스할루시네이션부터 데이터 유출 고민까지 한 번에 해결하세요!fastcampus.co.kr좋은 커리큘럼인 것 같다 2. LLM 파인튜닝 https://velog.io/@gaetokk/LLM-%ED%9B%88%EB%A0%A8-%EC%9A%A9%EC%96%B4%EB%93%A4-%EC%A0%95%EB%A6%AC 3. 프로젝트 참고 https://github.com/hunsii/LawBot?tab=readme-ov-file GitHub - hunsii/LawBot: LLM을 활용한 대화형 유사 판례 검색 시스템..
Allganize에서 제공한 자동화 코드를 사용했고, 3가지의 평가 모델을 사용하여 내가 만든 모델이 GT와 일치성이 높으면 "O", 그렇지 않으면 "X"를 출력하도록 설계 되어있다. 모델은 ChatOpenAI의 효율성 좋은 GPT4-mini를 사용하였고, vector DB는 qdrant를 썼다# modelllm = ChatOpenAI( temperature=0.1, model = "gpt-4o-mini")cache_dir = LocalFileStore("./.cache/")splitter = CharacterTextSplitter.from_tiktoken_encoder( separator="\n", chunk_size=600, chunk_overlap=100,)embeddin..
1. 성능 평가 방식에 대해 잘 정리된 블로그 링크 https://gagadi.tistory.com/58 [LLM Evaluation] LLM 성능 평가 방법 : Metric, Benchmark, LLM-as-a-judge 등🤖 LLM 성능 평가 방법 정리 📌 개요 LLM의 성능을 제대로 측정하는 작업은 모델의 개발 과정뿐만 아니라 수많은 LLM 중 어떤 모델을 선택할 것인지 결정하는 상황에서도 매우 중요하다. 즉, LLMgagadi.tistory.com 2. Allganize의 자동평가코드 사용법이 상세히 기재된 블로그 https://didi-universe.tistory.com/entry/RAG-RAG-%EB%B2%A4%EC%B9%98%EB%A7%88%ED%81%AC-%EB%8D%B0%EC%9D..
answers_prompt = ChatPromptTemplate.from_template( """ Using ONLY the following context answer the user's question. If you can't just say you don't know, don't make anything up. Then, give a score to the answer between 0 and 5. If the answer answers the user question the score should be high, else it should be low. Make sure to alw..
refine을 알아봤는데, Langchain 표현방식은 굉장히 다양한 것 같다. 어떤 방식으로 코드를 작성해야할지 고민이다 1번 방식initial_prompt = ChatPromptTemplate.from_messages( [ ( "system", """ You are a competent lawyer. Answer questions in Korean using only the following context. Use the following portion of a long document to see if any of the text is relevant to answer the question. ..
분할된 문서들을 처리하는 방법은 Stuff, Refine, Map Reduce, Map Re-rank 방식이 있으며, 이를 잘 정리한 블로그 링크를 첨부하겠다.https://pkgpl.org/2023/10/10/langchain-%EA%B8%B4-%EB%AC%B8%EC%84%9C-%EB%8B%A4%EB%A3%A8%EA%B8%B0/ LangChain 긴 문서 다루기: Stuff, Refine, Map Reduce, Map Re-rankLangChain에서 document loader를 이용해 문서를 읽어들인 후 text splitter를 이용해 긴 문서를 chunk들로 나누었습니다. 그 다음엔 분할한 문서들로 요약이나 질의응답(QA)과 같은 LLM 작업을 수행해야겠죠?pkgpl.org 이중 doc chun..
from langchain.chat_models import ChatOpenAIfrom langchain.document_loaders import UnstructuredFileLoaderfrom langchain.text_splitter import RecursiveCharacterTextSplitter, CharacterTextSplitterfrom langchain.embeddings import OpenAIEmbeddings, CacheBackedEmbeddingsfrom langchain.vectorstores import Chromafrom langchain.storage import LocalFileStorefrom qdrant_client.http.models import Distance,..