PEFT
Safetensors
Korean
phi3
custom_code
Edit model card

Housing-Subscription-QA-Phi-3.5

Model Details

Model Description

Model Sources

from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

config = PeftConfig.from_pretrained("hecatonai/Housing-Subscription-QA-Phi-3.5")
base_model = AutoModelForCausalLM.from_pretrained("microsoft/Phi-3.5-mini-instruct", device_map='auto')
model = PeftModel.from_pretrained(base_model, "hecatonai/Housing-Subscription-QA-Phi-3.5", device_map='auto')

# ํ† ํฌ๋‚˜์ด์ € ๋กœ๋“œ
tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3.5-mini-instruct", device_map='auto')

# ์ž…๋ ฅ ํ…์ŠคํŠธ ํฌ๋งทํŒ…
def apply_chat_template(question):
    template = "<|system|>\nYou are a helpful AI assistant. The default is 2024.<|end|>\n<|user|>\n{question}<|end|>\n<|assistant|>\n"
    return template.format(question=question)

# ์ž…๋ ฅ ํ…์ŠคํŠธ ํ† ํฌ๋‚˜์ด์ง•
question = "ํˆฌ๊ธฐ๊ณผ์—ด์ง€๊ตฌ ๋˜๋Š” ์ฒญ์•ฝ๊ณผ์—ด์ง€์—ญ์—์„œ ์™ธ๊ตญ์ธ 1์ˆœ์œ„ ์ฒญ์•ฝ ๊ฐ€๋Šฅ?"
input_text = apply_chat_template(question)

inputs = tokenizer(input_text, return_tensors="pt")

# ์˜ˆ์ธก ์ˆ˜ํ–‰
outputs = model.generate(**inputs, max_length=1000)

# ์ถœ๋ ฅ ๋””์ฝ”๋”ฉ
decoded_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(decoded_output)

Bias, Risks, and Limitations

ํ•ด๋‹น ๋ชจ๋ธ์€ ๋Œ€ํ•œ๋ฏผ๊ตญ ๊ตญํ† ๊ตํ†ต๋ถ€์—์„œ ๋ฐœํ–‰ํ•œ 2022๋…„๋„ ๋ฐ 2024๋…„๋„ ์ฃผํƒ์ฒญ์•ฝ FAQ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ
Fine-Tune ํ•œ LLM์ž…๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ํ•ด๋‹น FAQ์— ํฌํ•จ๋˜์ง€ ์•Š์€ ์งˆ๋ฌธ์— ๋Œ€ํ•ด์„œ๋Š” ๋ถ€์ •ํ™•ํ•œ ๋‹ต๋ณ€์„ ํ•  ์ˆ˜ ์žˆ์œผ๋‹ˆ ์‚ฌ์šฉ์— ์œ ์˜๋ฐ”๋ž๋‹ˆ๋‹ค.

How to Get Started with the Model

Use the code below to get started with the model.

from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

config = PeftConfig.from_pretrained("hecatonai/Housing-Subscription-QA-Phi-3.5")
base_model = AutoModelForCausalLM.from_pretrained("microsoft/Phi-3.5-mini-instruct", device_map='auto')
model = PeftModel.from_pretrained(base_model, "hecatonai/Housing-Subscription-QA-Phi-3.5", device_map='auto')

Using with Pipeline

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

model = AutoModelForCausalLM.from_pretrained("hecatonai/Housing-Subscription-QA-Phi-3.5", device_map='auto')

pipe = pipeline("text-generation", model=model, tokenizer="microsoft/Phi-3.5-mini-instruct", torch_dtype=torch.bfloat16, device_map="auto")
messages = [
    {"role": "system", "content": "You are a helpful AI assistant.  The default is 2024."},
    {"role": "user", "content": "ํˆฌ๊ธฐ๊ณผ์—ด์ง€๊ตฌ ๋ฐ ์ฒญ์•ฝ๊ณผ์—ด์ง€์—ญ 1์ˆœ์œ„ ์ œํ•œ๋Œ€์ƒ ๋ˆ„๊ตฌ?"}
]

prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipe(prompt, renormalize_logits=True, max_new_tokens=512, do_sample=False)
print(outputs[0]["generated_text"])

Result

<|system|>
You are a helpful AI assistant.  The default is 2024.<|end|>
<|user|>
ํˆฌ๊ธฐ๊ณผ์—ด์ง€๊ตฌ ๋ฐ ์ฒญ์•ฝ๊ณผ์—ด์ง€์—ญ 1์ˆœ์œ„ ์ œํ•œ๋Œ€์ƒ ๋ˆ„๊ตฌ?<|end|>
<|assistant|>
2024๋…„ ๋‹ต๋ณ€: ํˆฌ๊ธฐ๊ณผ์—ด์ง€๊ตฌ ๋ฐ ์ฒญ์•ฝ๊ณผ์—ด์ง€์—ญ์—์„œ ๊ตญ๋ฏผ์ฃผํƒ๊ณผ ๋ฏผ์˜์ฃผํƒ 1์ˆœ์œ„ ์ œํ•œ ๋Œ€์ƒ์€, ๊ณผ๊ฑฐ 5๋…„ ์ด๋‚ด์— ๋ณธ์ธ ๋˜๋Š” ์„ธ๋Œ€์›์ด ๋‹ค๋ฅธ ์ฃผํƒ์˜ ๋‹น์ฒจ์ž๊ฐ€ ๋œ ๊ฒฝ์šฐ์ž…๋‹ˆ๋‹ค.

Training Details

Training Data

dataset: Housing_Subscription_QA_Dataset

Training Hyperparameters

This model following Hyperparameters were used during training:

  • bf16 = True
  • learning_rate = 5.0e-5
  • num_train_epochs = 15
  • per_device_batch_size = 4
  • warmup_ratio = 0.2

Traning Prompt

 messages = [{"role": "system", "content": "You are a helpful AI assistant."},
    {"role": "user", "content": f"{example['question']}"},
    {"role": "assistant", "content": f"{example['answer']}"}]

Framework versions

  • PEFT 0.12.0
  • Transformers 4.44.2
Downloads last month
2
Inference API
Unable to determine this modelโ€™s pipeline type. Check the docs .

Model tree for hecatonai/Housing-Subscription-QA-Phi-3.5

Adapter
(107)
this model

Dataset used to train hecatonai/Housing-Subscription-QA-Phi-3.5