AIRider commited on
Commit
b2835cd
·
verified ·
1 Parent(s): 63c0bf4

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +6 -24
handler.py CHANGED
@@ -1,26 +1,8 @@
1
- # handler.py
2
- import torch
3
- from transformers import AutoModelForSequenceClassification, AutoTokenizer
4
 
5
- def handle(request):
6
- # 모델 로드
7
- model = AutoModelForSequenceClassification.from_pretrained("AIRider/Ko-Llama3-Luxia-8B-Q4_K_M-GGUF")
8
- tokenizer = AutoTokenizer.from_pretrained("AIRider/Ko-Llama3-Luxia-8B-Q4_K_M-GGUF")
9
 
10
- # 입력 데이터 처리
11
- input_text = request.inputs["text"]
12
- inputs = tokenizer.encode_plus(
13
- input_text,
14
- add_special_tokens=True,
15
- max_length=512,
16
- return_attention_mask=True,
17
- return_tensors="pt",
18
- )
19
-
20
- # 모델 추론
21
- outputs = model(inputs["input_ids"], attention_mask=inputs["attention_mask"])
22
- logits = outputs.logits
23
-
24
- # 결과 반환
25
- result = torch.argmax(logits).item()
26
- return {"result": result}
 
1
+ from huggingfacehub import HuggingfaceHubModelregistry
2
+ from transformers import AutoModelorSequenceClassification
 
3
 
4
+ # AIider/o-Llama3-Luxia-8B-Q4M-GG 모델을 로드합니다
5
+ model = AutoModelorSequenceClassification.frompretrained("AIRider/Ko-Llama3-Luxia-8B-Q4_K_M-GGUF")
 
 
6
 
7
+ # HuggingfaceHubModelregistry를 사용하여 모델을 등록합니다
8
+ HuggingfaceHubModelregistry.register(model)