Instructions to use GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("K-intelligence/Midm-2.0-Base-Instruct") model = PeftModel.from_pretrained(base_model, "GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA") - Transformers
How to use GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA
- SGLang
How to use GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA with Docker Model Runner:
docker model run hf.co/GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA
Update README.md
Browse files
README.md
CHANGED
|
@@ -16,12 +16,75 @@ tags:
|
|
| 16 |
|
| 17 |
## Model Details
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
<!-- Provide a longer summary of what this model is. -->
|
| 22 |
|
|
|
|
| 23 |
|
|
|
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
- **Developed by:** [More Information Needed]
|
| 26 |
- **Funded by [optional]:** [More Information Needed]
|
| 27 |
- **Shared by [optional]:** [More Information Needed]
|
|
@@ -204,4 +267,4 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
|
|
| 204 |
[More Information Needed]
|
| 205 |
### Framework versions
|
| 206 |
|
| 207 |
-
- PEFT 0.16.0
|
|
|
|
| 16 |
|
| 17 |
## Model Details
|
| 18 |
|
| 19 |
+
๋ณธ ๋ชจ๋ธ์ ๊ตญ๋ฆฝ๊ตญ์ด์ ์ฃผ์ต 2025๋
์ธ๊ณต์ง๋ฅ์ ํ๊ตญ์ด ๋ฅ๋ ฅ ํ๊ฐ ๊ฒฝ์ง๋ํ [2025]ํ๊ตญ๋ฌธํ ์ง์์๋ต(๊ฐ ์ ํ) ISNLPํ ์ต์ข
์ ์ถ๋ฌผ์ด๋ค.
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
## Model Description
|
| 22 |
|
| 23 |
+
<!-- Provide a longer summary of what this model is. -->
|
| 24 |
|
| 25 |
+
ํ์ต๋ฐ์ดํฐ๋ 2025๋
์ธ๊ณต์ง๋ฅ์ ํ๊ตญ์ด ๋ฅ๋ ฅ ํ๊ฐ ๊ฒฝ์ง๋ํ [2025]ํ๊ตญ๋ฌธํ ์ง์์๋ต(๊ฐ ์ ํ)์์ ์ฃผ์ด์ง train dataset์ ์ด์ฉํ์ฌ ํ์ตํ์๋ค.
|
| 26 |
+
|
| 27 |
+
data link(ํ์ฌ ๋ค์ด๋ก๋ ๋ถ๊ฐ): http://kli.korean.go.kr/taskOrdtm/taskList.do?taskOrdtmId=180&clCd=END_TASK&subMenuId=sub01
|
| 28 |
+
|
| 29 |
+
ํด๋น ๊ณผ์ ์์๋ Midm-base+QLoRA๋ชจ๋ธ์ ๊ธฐ๋ฐ์ผ๋ก GRPO + Descriptive Answer Candidate๋ก ํ์ตํ์๋ค.
|
| 30 |
+
|
| 31 |
+
์์ธํ ํ์ต ๋ฐฉ๋ฒ๋ก ๋ฐ ํ์ต ์ฝ๋๋ https://github.com/KimGyunYeop/2025_MalPyeong_QA_ISNLP_RLVR_WTA ์์ ํ์ธํ ์ ์๋ค.
|
| 32 |
+
|
| 33 |
+
## Model Usage
|
| 34 |
+
|
| 35 |
+
```
|
| 36 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, GenerationConfig
|
| 37 |
+
from peft import LoraConfig, PeftModelForCausalLM
|
| 38 |
+
import torch
|
| 39 |
+
|
| 40 |
+
adapter_path = "GyunYeop/midm-base-GRPO-lora-tuning-KoreanCultureQA"
|
| 41 |
+
lora_config = LoraConfig.from_pretrained(adapter_path)
|
| 42 |
+
model_name = lora_config.base_model_name_or_path
|
| 43 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 44 |
+
generation_config= GenerationConfig.from_pretrained(model_name)
|
| 45 |
+
|
| 46 |
+
bnb_config = BitsAndBytesConfig(
|
| 47 |
+
load_in_4bit=True, # 4โbit ๊ฐ์ค์น
|
| 48 |
+
bnb_4bit_quant_type="nf4", # NormalโFloatโฏ4
|
| 49 |
+
bnb_4bit_use_double_quant=True, # doubleโquant
|
| 50 |
+
bnb_4bit_compute_dtype=torch.bfloat16, # Ada, Hopper, MI300 ๋ฑ
|
| 51 |
+
llm_int8_skip_modules=["lm_head"] # ์ถ๋ ฅ์ธต์ FP16
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
base_model = AutoModelForCausalLM.from_pretrained(model_name,
|
| 55 |
+
device_map="cuda:0",
|
| 56 |
+
trust_remote_code=True,
|
| 57 |
+
quantization_config=bnb_config,
|
| 58 |
+
)
|
| 59 |
+
|
| 60 |
+
model = PeftModelForCausalLM.from_pretrained(base_model, adapter_path)
|
| 61 |
+
model.load_adapter(adapter_path, subfolder="selection", adapter_name="selection")
|
| 62 |
+
|
| 63 |
+
prompt = '๋จ๋ตํ ๋ฌธ์ ์์ ์ ๋ต์ ๋ง์ถ๊ธฐ์ํด ๋ฐ๋์ ์ถฉ๋ถํ ์๊ฐํด๋ณด๊ณ "์๊ฐ ๊ณผ์ :" ์ดํ์ ์ ๋ต ๊ทผ๊ฑฐ ๋ฐ ์๊ฐ๊ณผ์ ์ ์์ฑ ํ ๋ค์ ์ดํ ์ต์ข
๋ต๋ณ์ ์์ฑํ ๊ฒ (๋ฌธ์ ์ ํ: ๋จ๋ตํ ์๊ฐ๊ณผ์ : {์๊ฐ๊ณผ์ } ๋ต๋ณ: {์ต์ข
๋ต๋ณ} ํํ)'
|
| 64 |
+
question = '๋ฌธ์ ์ ํ: ๋จ๋ตํ \n ์ง๋ฌธ: 2005๋
์ ๊ฐ๊ดํ์์ผ๋ฉฐ, ๊ต์ก ๋ฐ ๋ฌธํ์ ๋ชฉ์ ์ผ๋ก ์ํ๋ฅผ ์์ํ๋ ์์ธ์ ์ ์ผํ ๋น์๋ฆฌ ๋ฏผ๊ฐ ์๋ค๋งํ
ํฌ ์ ์ฉ๊ด์ ์ด๋์ธ๊ฐ์?'
|
| 65 |
+
inputs = tokenizer.apply_chat_template(
|
| 66 |
+
[
|
| 67 |
+
{"role": "system", "content": prompt},
|
| 68 |
+
{"role": "user", "content": question}
|
| 69 |
+
],
|
| 70 |
+
tokenize=True,
|
| 71 |
+
add_generation_prompt=True,
|
| 72 |
+
return_tensors="pt"
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
answer = model.generate(
|
| 76 |
+
inputs.to("cuda:0"),
|
| 77 |
+
generation_config=generation_config,
|
| 78 |
+
max_new_tokens=1024,
|
| 79 |
+
do_sample=True
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
answer_text = tokenizer.decode(answer[0][inputs.shape[-1]:], skip_special_tokens=True)
|
| 83 |
+
print(answer_text)
|
| 84 |
+
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
<!--
|
| 88 |
- **Developed by:** [More Information Needed]
|
| 89 |
- **Funded by [optional]:** [More Information Needed]
|
| 90 |
- **Shared by [optional]:** [More Information Needed]
|
|
|
|
| 267 |
[More Information Needed]
|
| 268 |
### Framework versions
|
| 269 |
|
| 270 |
+
- PEFT 0.16.0 -->
|