[Huggingface] Model Memory Calculator, GPU ์–ผ๋งˆ๋ฉด ๋˜๋‹ˆ?
ยท
๐Ÿ—ฃ๏ธ Natural Language Processing
Model Memory Calculator, GPU ์–ผ๋งˆ๋ฉด ๋˜๋‹ˆ?  llama3, gemma2, florence ๋“ฑ llama1(2023.2.24)์ด ๋‚˜์˜จ ์ง€ ๋ฒŒ์จ 1๋…„์ด ๋„˜์–ด๊ฐ€๋Š”๋ฐ ์•„์ง ์˜คํ”ˆ llm์˜ ์ธ๊ธฐ๋Š” ์‹์„ ์ค„ ๋ชจ๋ฅด๊ณ  ์žˆ๋‹ค. ์•„๋‹ˆ ๋” ์ธ๊ธฐ๊ฐ€ ๋Š˜๊ณ  ์žˆ๋‹ค. ํ•™์Šต ํŒŒ์ดํ”„๋ผ์ธ์€ ๋”์šฑ ์‰ฝ๊ณ  ๊ฒฌ๊ณ ํ•ด์ง€๊ณ  ๋ชจ๋ธ inference๋Š” ๋”์šฑ ๋ฆฌ์†Œ์Šค ์†๋„ ๋‹ค ๋ฐœ๋‹ฌํ•˜๊ณ  ์žˆ๋‹ค. ๊ทธ๋Ÿฐ๊ณ ๋กœ ๋‚˜์˜ ๋ฆฌ์†Œ์Šค์— ๋งž๋Š” ๋ชจ๋ธ์€ ๋ฌด์—‡์ด๊ณ  ์ตœ๋Œ€์น˜๋กœ ๋Œ๋ฆด ์ˆ˜ ์žˆ๋Š” ๊ฒƒ๋“ค์ด ๊ถ๊ธˆํ•  ๊ฒƒ์ด๋‹ค.  ๋จผ์ € 2b, 7b, 9b์ด ์ˆซ์ž์— ๋Œ€ํ•ด ๊ฐ„๋‹จํžˆ ์„ค๋ช…ํ•˜๋ฉด ๋ชจ๋ธ์ด ํ•™์Šตํ•œ parameter์˜ ์ˆ˜์ด๋‹ค. ๊ฐ„๋‹จํžˆ ์ด์•ผ๊ธฐํ•˜๋ฉด ๋ชจ๋ธ์ด ํ‘œํ˜„ํ•  ์ˆ˜์žˆ๋Š” ๊ฒฝ์šฐ์˜ ์ˆ˜๊ฐ€ ์ด๋งŒํผ ๋งŽ๋‹ค๋Š” ๊ฒƒ์ด๋‹ค. ๊ณผ๊ฑฐ BERT ๋ชจ๋ธ์˜ ๋‹จ์œ„๊ฐ€ 3M, 5M ๋ฐฑ๋งŒ ๋‹จ์œ„๋ผ๋ฉด ์ง€๊ธˆ์€ ์ˆ˜์‹ญ์–ต ๋‹จ์œ„๋กœ ๋„˜์–ด์™”..
[Ollama] Response Structure Answer
ยท
๐Ÿ› ๏ธ Tools
Ollama + Langchain Local llm์˜ ์„ฑ๋Šฅ์ด ๋‚˜๋‚ ์ด ์ข‹์•„์ง€๋ฉฐ ์ด์ œ๋Š” 8b์ด์ƒ์˜ ๋ชจ๋ธ ์ •๋„๋ฉด ํ•œ๊ตญ์–ด instruction์ด ์ž˜๋˜์–ด CoT๋ฅผ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ๋‹ค. ๊ฐ„๋‹จํ•œ ์˜ˆ์ œ๋ฅผ ํ†ตํ•ด ์ด๋ฆฌ๋กœ ์ €๋ฆฌ๋กœ ํŠ€๋˜ LLM์„ ์–ด๋–ป๊ฒŒ ์ œ์–ดํ•˜๋Š” ์ง€ ์•Œ์•„๋ณด์ž.    1.  Ollama cpp ๋ชจ๋ธ ์ค‘ ์ตœ๊ทผ์— ๊ณต๊ฐœ๋œ Gemma2 ์‚ฌ์šฉ gemma2 ๋ชจ๋ธ ์ค‘ ๊ธฐ๋ณธ ๋ชจ๋ธ์€ 9b ๋ชจ๋ธ๋กœ google์—์„œ ๋งŒ๋“  gemma์˜ ๋ฒ„์ „ 2์ธ open source llm์ด๋‹ค. ํ•œ๊ตญ์–ด๋„ ์ž˜ํ•ด์„œ ๋ช‡ ์•ˆ๋˜๋Š”  ํ•œ๊ตญ์–ด ์˜คํ”ˆ Foundation ๋ชจ๋ธ์ด๋‹ค. google ๋ชจ๋ธ์˜ ํŠน์ง•์ด Markdown์œผ๋กœ output์„ ๋ฐ›์•„ ์›ํ•˜๋Š” ํ˜•ํƒœ๋กœ ๋” ๋„“๊ฒŒ ๊ฐ€๊ณตํ•ด ๋ฐ›์„ ์ˆ˜์žˆ๋‹ค.   from langchain_community.llms import O..
[crewAI] Multi-agent Custormer Support Automation (3)
ยท
๐Ÿ› ๏ธ Tools
L3: Multi-agent Custormer Support AutomationMulti-agent๋ฅผ ํ™œ์šฉํ•œ ๊ณ ๊ฐ ์ง€์› ์ž๋™ํ™” ์‹œ์Šคํ…œ Role PlayingFocusToolsCooperationGuardrailsMemory ํ•„์ˆ˜ ํŒจํ‚ค์ง€ ์„ค์น˜!pip install crewai==0.28.8 crewai_tools==0.1.6 langchain_community==0.0.29 In [44]:# ๊ฐ„๋‹จํ•œ warning ์ถœ๋ ฅ ๋ฌด์‹œimport warningswarnings.filterwarnings(action='ignore')In [45]:# crewai ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ importfrom crewai import Agent, Task, CrewIn [46]:# utils.py# Add your utilities or..
[CrewAI] Key elements of AI agent (2)
ยท
๐Ÿ› ๏ธ Tools
Key elements of AI agentRole Playingrole์— ๋”ฐ๋ผ agent์˜ ์‘๋‹ต์ด ๋‹ฌ๋ผ์งTesla์˜ ์ฃผ๊ฐ€๋ฅผ ๋ถ„์„ํ•ด ๋‹ฌ๋ผ๊ณ  ์š”์ฒญํ•ด๋ณด์ž.1. give me an analysis on tesla stock.๋”๋ณด๊ธฐAs of May 2024, Tesla's stock (TSLA) is facing a complex landscape with both significant challenges and potential opportunities.Current Performance and Outlook:Tesla's stock is currently trading around $177, having experienced a decline of approximately 31% year-to-dateโ€‹ (..
Embedding Model API ํ•œ๊ตญ์–ด Token & ๋น„์šฉ ๋น„๊ต
ยท
๐Ÿ—ฃ๏ธ Natural Language Processing
“๋Œ€ํ•œ๋ฏผ๊ตญ ๋ฒ•๋ฅ  ์ „๋ฌธ”์„ ๊ฐ€์ง€๊ณ  OpenAI(ChatGPT), GOOGLE(Gemini), Antropic(Claude), Upstage(Solar)๋ฅผ ๋Œ€์ƒ์œผ๋กœ embedding ํ›„ token ์ˆ˜๋ฅผ ๋น„๊ตํ•˜๋Š” ์‹คํ—˜์„ ์ง„ํ–‰ Goal : API๋กœ ์ œ๊ณต๋˜๋Š” LLM ์ค‘ ์–ด๋–ค ๋ชจ๋ธ์ด ํ•œ๊ตญ์–ด token์„ ๊ฐ€์žฅ ์ ๊ฒŒ ์‚ฌ์šฉํ•˜๊ณ  ๋น„์šฉ ์ €๋ ดํ•œ์ง€ ๋น„๊ต Input Text(๋Œ€ํ•œ๋ฏผ๊ตญํ—Œ๋ฒ• ์ „๋ฌธ, text length=373) ์œ ๊ตฌํ•œ ์—ญ์‚ฌ์™€ ์ „ํ†ต์— ๋น›๋‚˜๋Š” ์šฐ๋ฆฌ๋“ค ๋Œ€ํ•œ๊ตญ๋ฏผ์€ ๊ธฐ๋ฏธ ์‚ผ์ผ์šด๋™์œผ๋กœ ๋Œ€ํ•œ๋ฏผ๊ตญ์„ ๊ฑด๋ฆฝํ•˜์—ฌ ์„ธ๊ณ„์— ์„ ํฌํ•œ ์œ„๋Œ€ํ•œ ๋…๋ฆฝ์ •์‹ ์„ ๊ณ„์Šนํ•˜์—ฌ ์ด์ œ ๋ฏผ์ฃผ๋…๋ฆฝ๊ตญ๊ฐ€๋ฅผ ์žฌ๊ฑดํ•จ์— ์žˆ์–ด์„œ ์ •์˜์ธ๋„์™€ ๋™ํฌ์• ๋กœ์จ ๋ฏผ์กฑ์˜ ๋‹จ๊ฒฐ์„ ๊ณต๊ณ ํžˆ ํ•˜๋ฉฐ ๋ชจ๋“  ์‚ฌํšŒ์  ํ์Šต์„ ํƒ€ํŒŒํ•˜๊ณ  ๋ฏผ์ฃผ์ฃผ์˜์ œ์ œ๋„๋ฅผ ์ˆ˜๋ฆฝํ•˜์—ฌ ์ •์น˜, ๊ฒฝ์ œ, ์‚ฌํšŒ, ๋ฌธํ™”์˜ ๋ชจ๋“  ์˜์—ญ์— ์žˆ์–ด..
[OWASP-LLM] Top 10 List for Large Language Models version 0.1 - (2) Data Leakage
ยท
๐Ÿƒ Routine
LLM02:2023 ๋ฐ์ดํ„ฐ ์œ ์ถœ ์„ค๋ช…: ๋ฐ์ดํ„ฐ ์œ ์ถœ์€ LLM์ด ์‘๋‹ต์„ ํ†ตํ•ด ์‹ค์ˆ˜๋กœ ๋ฏผ๊ฐํ•œ ์ •๋ณด, ๋…์  ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋˜๋Š” ๊ธฐํƒ€ ๊ธฐ๋ฐ€ ์„ธ๋ถ€ ์ •๋ณด๋ฅผ ๋ˆ„์ถœํ•˜๋Š” ๊ฒฝ์šฐ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ์ด๋กœ ์ธํ•ด ๋ฏผ๊ฐํ•œ ๋ฐ์ดํ„ฐ ๋˜๋Š” ์ง€์  ์žฌ์‚ฐ์— ๋Œ€ํ•œ ๋ฌด๋‹จ ์•ก์„ธ์Šค, ๊ฐœ์ธ ์ •๋ณด ์นจํ•ด ๋ฐ ๊ธฐํƒ€ ๋ณด์•ˆ ์œ„๋ฐ˜์ด ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ผ๋ฐ˜์ ์ธ ๋ฐ์ดํ„ฐ ์œ ์ถœ ์ทจ์•ฝ์ : LLM์˜ ์‘๋‹ต์—์„œ ๋ฏผ๊ฐํ•œ ์ •๋ณด๋ฅผ ๋ถˆ์™„์ „ํ•˜๊ฑฐ๋‚˜ ๋ถ€์ ์ ˆํ•˜๊ฒŒ ํ•„ํ„ฐ๋งํ•˜๋Š” ๊ฒฝ์šฐ. LLM์˜ ํ›ˆ๋ จ ๊ณผ์ •์—์„œ ๋ฏผ๊ฐํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ์˜ค๋ฒ„ํ”ผํŒ…ํ•˜๊ฑฐ๋‚˜ ๋ฉ”๋ชจ๋ฆฌ์ œ์ด์…˜ํ•˜๋Š” ๊ฒฝ์šฐ. LLM์˜ ์˜คํ•ด ๋˜๋Š” ์˜ค๋ฅ˜๋กœ ์ธํ•ด ๊ธฐ๋ฐ€ ์ •๋ณด๊ฐ€ ๋ฌด๋‹จ์œผ๋กœ ๊ณต๊ฐœ๋˜๋Š” ๊ฒฝ์šฐ. ์˜ˆ๋ฐฉ ๋ฐฉ๋ฒ•: LLM์ด ๋ฏผ๊ฐํ•œ ์ •๋ณด๋ฅผ ๋ˆ„์ถœํ•˜์ง€ ์•Š๋„๋ก ์—„๊ฒฉํ•œ ์ถœ๋ ฅ ํ•„ํ„ฐ๋ง ๋ฐ ๋ฌธ๋งฅ ์ธ์‹ ๋ฉ”์ปค๋‹ˆ์ฆ˜์„ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค. LLM์˜ ํ›ˆ๋ จ ๊ณผ์ •์—์„œ ์ฐจ๋“ฑ ๊ฐœ์ธ ์ •๋ณด ๋ณดํ˜ธ ๊ธฐ๋ฒ•์ด๋‚˜ ๊ธฐํƒ€ ๋ฐ์ดํ„ฐ..
[LangChain] No using OpenAI API RetrievalQA
ยท
๐Ÿ—ฃ๏ธ Natural Language Processing
LangChain No using OpenAI API (1) QA๋ฅผ ์œ„ํ•œ Document ๋ถˆ๋Ÿฌ์˜ค๊ธฐ # Load and process the text files # loader = TextLoader("./data/texts") loader = DirectoryLoader('./pdf/', glob="./*.pdf", loader_cls=PyPDFLoader) documents = loader.load() # Document ๋ถ„์ ˆ text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200) texts = text_splitter.split_documents(documents) (2) Embedding # HuggingF..
๋‹คํ–ˆ๋‹ค
'llm' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก