heesuuuuuu commited on
Commit
a869f0d
ยท
verified ยท
1 Parent(s): 373f7cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -32,7 +32,7 @@ import gradio as gr # Gradio ์ž„ํฌํŠธ ์ถ”๊ฐ€
32
  print("Vector DB์™€ ์ž„๋ฒ ๋”ฉ ๋ชจ๋ธ์„ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘์ž…๋‹ˆ๋‹ค...")
33
  index_path = "proj2_voca"
34
  model_name = "jhgan/ko-sroberta-multitask"
35
- model_kwargs = {'device': 'cuda'}
36
  encode_kwargs = {'normalize_embeddings': True}
37
  embeddings = HuggingFaceEmbeddings(
38
  model_name=model_name,
@@ -50,7 +50,7 @@ model = AutoModelForCausalLM.from_pretrained(
50
  model_id,
51
  torch_dtype=torch.bfloat16,
52
  device_map=None # ์ž๋™ ๋ฐฐ์น˜ ๋น„ํ™œ์„ฑํ™”
53
- ).to("cuda:2") # GPU ๋ฒˆํ˜ธ ๋ช…์‹œ
54
 
55
  # --- 2. ์–ธ์–ด ๋ชจ๋ธ(LLM) ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ---
56
  # ... (์ด์ „ ์ฝ”๋“œ ์ƒ๋žต) ...
@@ -58,7 +58,7 @@ pipe = pipeline(
58
  "text-generation",
59
  model=model,
60
  tokenizer=tokenizer,
61
- device=2,
62
  max_new_tokens=170, # ์ตœ๋Œ€ ์ƒ์„ฑ ํ† ํฐ ์ˆ˜ ๊ฐ์†Œ
63
  temperature=0.7,
64
  repetition_penalty=1.2, # ๋ฐ˜๋ณต ๋ฐฉ์ง€ ํŒจ๋„ํ‹ฐ ์ถ”๊ฐ€
 
32
  print("Vector DB์™€ ์ž„๋ฒ ๋”ฉ ๋ชจ๋ธ์„ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘์ž…๋‹ˆ๋‹ค...")
33
  index_path = "proj2_voca"
34
  model_name = "jhgan/ko-sroberta-multitask"
35
+ model_kwargs = {'device': 'cpu'}
36
  encode_kwargs = {'normalize_embeddings': True}
37
  embeddings = HuggingFaceEmbeddings(
38
  model_name=model_name,
 
50
  model_id,
51
  torch_dtype=torch.bfloat16,
52
  device_map=None # ์ž๋™ ๋ฐฐ์น˜ ๋น„ํ™œ์„ฑํ™”
53
+ ).to("cpu") # GPU ๋ฒˆํ˜ธ ๋ช…์‹œ
54
 
55
  # --- 2. ์–ธ์–ด ๋ชจ๋ธ(LLM) ๋ถˆ๋Ÿฌ์˜ค๊ธฐ ---
56
  # ... (์ด์ „ ์ฝ”๋“œ ์ƒ๋žต) ...
 
58
  "text-generation",
59
  model=model,
60
  tokenizer=tokenizer,
61
+ device=-1,
62
  max_new_tokens=170, # ์ตœ๋Œ€ ์ƒ์„ฑ ํ† ํฐ ์ˆ˜ ๊ฐ์†Œ
63
  temperature=0.7,
64
  repetition_penalty=1.2, # ๋ฐ˜๋ณต ๋ฐฉ์ง€ ํŒจ๋„ํ‹ฐ ์ถ”๊ฐ€