gong1221 commited on
Commit
496714a
·
verified ·
1 Parent(s): 03fa798

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +25 -2
README.md CHANGED
@@ -23,9 +23,32 @@ NSMC 데이터셋으로 파튜닝된 한국어 감정 분석 모델입니다.
23
  파인튜닝 방법: LoRA
24
  언어: 한국어
25
 
26
- ## 사용 방법
27
  - ** 최종 성능**: Accruacy 85%
28
- ```python
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  ```
31
 
 
23
  파인튜닝 방법: LoRA
24
  언어: 한국어
25
 
26
+
27
  - ** 최종 성능**: Accruacy 85%
28
+
29
+ ## 사용 방법
30
+
31
+ ```from peft import PeftModel
32
+
33
+ # 베이스 모델 로드 (분류용)
34
+ print("베이스 모델 로딩")
35
+ base_model_reload = AutoModelForSequenceClassification.from_pretrained(
36
+ "klue/bert-base",
37
+ num_labels=2
38
+ )
39
+
40
+ # 업로드한 LoRA 어댑터 로드
41
+ print(f"LoRA 어댑터 로딩: gong1221/nsmc-sentiment-lora")
42
+ model_reload = PeftModel.from_pretrained(base_model_reload, model_name_upload)
43
+ tokenizer_reload = AutoTokenizer.from_pretrained(model_name_upload)
44
+
45
+ # GPU로 이동
46
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
47
+ model_reload = model_reload.to(device)
48
+ model_reload.eval()
49
+
50
+ print("모델 로드 완료!")
51
+ print("이제 이 코드로 어디서든 내 모델을 사용할 수 있습니다!")
52
 
53
  ```
54