Skip to content

๐Ÿง ์„ธ์ปจ๋“œ๋ธŒ๋ ˆ์ธ, ๐Ÿ“์ œํ…”์นด์Šคํ…์—์„œ ์ถœ๋ฐœํ•œ ์ง€์‹๊ด€๋ฆฌ๋„๊ตฌ!

Notifications You must be signed in to change notification settings

tae0y/BrainBeaver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

27 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Brain Beaver ๐Ÿฆซ

๋ฐ๋ชจ, ํ”„๋กœ์ ํŠธ ์†Œ๊ฐœ

๐Ÿ’ก Streamlit | DEMO

  • ๋งˆํฌ๋‹ค์šด ํŒŒ์ผ์„ ์ง€์‹๋‹จ์œ„๋กœ ๋ถ„ํ•ดํ•˜๊ณ  ์—ฐ๊ด€๊ด€๊ณ„๋ฅผ ๊ทธ๋ž˜ํ”„ํ™”
  • ์—ฐ๊ด€๊ด€๊ณ„์—์„œ ์‹œ์ž‘์ ์ด ๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์œผ๋ฉด ์—ฐ๋‘์ƒ‰, ๋„์ฐฉ์ง€๋Š” ์ดˆ๋ก์ƒ‰
    • pgvector ์ฝ”์‚ฌ์ธ ์œ ์‚ฌ๋„๋กœ topk๋ฅผ ๊ตฌํ•œ ๋‹ค์Œ
    • ๋ฒกํ„ฐ๋‚ด์ ์ด 0.7 ์ด์ƒ์ธ ๊ฒฝ์šฐ์—๋งŒ ์—ฐ๊ด€์žˆ๋Š” ๊ฒƒ์œผ๋กœ ํŒ๋‹จ
  • ์›น๊ฒ€์ƒ‰์‹œ ๊ท€๋ฌด๊ฐ€์„ค์ด ์ฐธ์ด๋ผ๋ฉด ๋นจ๊ฐ„ ๋…ธ๋“œ๋กœ ์ถ”๊ฐ€์—ฐ๊ฒฐ
    • ๊ท€๋ฌด๊ฐ€์„ค์€ ์›น๊ฒ€์ƒ‰๊ฒฐ๊ณผ๋ณ„ ํŽ˜๋ฅด์†Œ๋‚˜์™€ ์ฃผ์žฅํ•˜๋Š” ๋‚ด์šฉ์„ ์ถ”์ถœ
    • ์ „๋ฌธ๊ฐ€๋“ค ์ฐฌ/๋ฐ˜ ์˜๊ฒฌ์„ ๋‹ค์ˆ˜๊ฒฐ๋กœ ์ฑ„ํƒ/๊ธฐ๊ฐ
    • ์ฑ„ํƒํ•˜๋ฉด ๋นจ๊ฐ„ ๋…ธ๋“œ๋ฅผ ์ถ”๊ฐ€ ์—ฐ๊ฒฐํ•ด์คŒ

๋”๋ฏธ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•œ ๋ฐ๋ชจ ๊ตฌ๋™๋ฐฉ๋ฒ•

๊ฐ€์ƒํ™˜๊ฒฝ๊ณผ ์˜์กด์„ฑ์„ ์„ค์น˜ํ•˜๊ณ 

python -m venv .venv
. .venvb/bin/activate
pip install -r requirements.txt

python/demo ํŽ˜์ด์ง€๋กœ ๋“ค์–ด๊ฐ€์„œ ๋ฐ”๋กœ ๊ตฌ๋™ํ•ฉ๋‹ˆ๋‹ค!

streamlit run demo.py

docker/์ž๊ธฐ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•ด ๊ตฌ๋™ํ•˜๋Š” ๋ฐฉ๋ฒ•

M1 ๋งฅ๋ถ์—์–ด ๊ธฐ์ค€์œผ๋กœ ๋กœ์ปฌ์—์„œ ๊ตฌ๋™ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์„ค๋ช…๋“œ๋ฆฝ๋‹ˆ๋‹ค.

๊ฐ€์ƒํ™˜๊ฒฝ๊ณผ ์˜์กด์„ฑ์„ ์„ค์น˜ํ•˜๊ณ 

python -m venv .venv
. .venvb/bin/activate
pip install -r requirements.txt

docker ํด๋”๋กœ ์ง„์ž…ํ•ด์„œ db์™€ dbadmin์„ ๊ตฌ๋™ํ•ฉ๋‹ˆ๋‹ค.
docker์ด๋ฏธ์ง€๊ฐ€ ์—†๋‹ค๋ฉด ๋นŒ๋“œ๋ถ€ํ„ฐ ํ•ด์ค๋‹ˆ๋‹ค.

docker-compose build #๊ด€๋ฆฌ์ž๊ถŒํ•œ์œผ๋กœ ์‹คํ–‰
docker compose up

ํ•„์š”ํ•œ ์˜์กด์„ฑ์„ ์„ค์น˜ํ•˜๊ณ  app.py์—์„œ ์•„๋ž˜์™€ ๊ฐ™์ด ๋ฃจํŠธ๊ฒฝ๋กœ, ์ƒ˜ํ”Œ๋ง, ํ…Œ์ŠคํŠธ ๊ฐœ์ˆ˜๋ฅผ ์กฐ์ •ํ•ฉ๋‹ˆ๋‹ค.

# ๋งˆํฌ๋‹ค์šด ํŒŒ์ผ์ด ์œ„์น˜ํ•œ ๋ฃจํŠธ๊ฒฝ๋กœ๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.
root_dir = '/Users/bachtaeyeong/20_DocHub/TIL'

# ํŒŒ์ผ์„ ๋ฒ„ํ‚ท ์‚ฌ์ด์ฆˆ๋งŒํผ ๋žœ๋คํ•˜๊ฒŒ ์ƒ˜ํ”Œ๋งํ•ฉ๋‹ˆ๋‹ค
file_list = sample_file_list(file_list=file_list, bucket_size=10)

# ํŒŒ์ผ์„ ์ •ํ•ด์ง„ ํ…Œ์ŠคํŠธ๊ฑด์ˆ˜๋งŒํผ๋งŒ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
keyconcept_list = split_file_into_keyconcept(file_list=file_list[:10])

python ํด๋”๋กœ ์ด๋™ํ•ด์„œ app.py ํŒŒ์ผ์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
ํ‘œ์ค€์ถœ๋ ฅ์€ ๋กœ๊ทธํŒŒ์ผ์— ์ €์žฅํ•˜๊ณ , tqdm ํ”„๋กœ๊ทธ๋ ˆ์Šค๋ฐ”๋งŒ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
wandb๋ฅผ ์ ์šฉํ•ด๋‘ฌ์„œ app.py๋งŒ ์‹คํ–‰ํ•ด๋„ ๋˜๊ธดํ•ฉ๋‹ˆ๋‹ค.

python app.py > logs/$(date +%Y-%m-%d_%H:%M:%S).log

๋™์ผํ•˜๊ฒŒ python ํด๋”์—์„œ streamlit์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

streamlit run view.py

๋กœ์ปฌ์—์„œ ๊ตฌ๋™ํ•œ ๋ฐ๋ชจ๋ฅผ ์‚ญ์ œํ• ๋•Œ๋Š” ์ด๋ ‡๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

docker compose down #์ƒ์„ฑํ•œ ๋„์ปค ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์‚ญ์ œ๋จ
docker volume prune #๋„์ปค ์ปจํ…Œ์ด๋„ˆ์— ํ• ๋‹น๋˜์ง€ ์•Š์€ ๊ฐ€์ƒ ๋ณผ๋ฅจ์„ ๋ชจ๋‘ ์‚ญ์ œ

About

๐Ÿง ์„ธ์ปจ๋“œ๋ธŒ๋ ˆ์ธ, ๐Ÿ“์ œํ…”์นด์Šคํ…์—์„œ ์ถœ๋ฐœํ•œ ์ง€์‹๊ด€๋ฆฌ๋„๊ตฌ!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published