Hugging Face 모델을 다운로드하여 Ollama에서 사용하기
한국어가 포함되어 있는 llama-3.2-Korean Models를 사용해보겠습니다.
(https://huggingface.co/Bllossom/llama-3.2-Korean-Bllossom-3B-gguf-Q4_K_M)

1. llama-3.2-Korean Models을 다운로드합니다.
(https://huggingface.co/Bllossom/llama-3.2-Korean-Bllossom-3B-gguf-Q4_K_M/tree/main)

2. llama-3.2-Korean-Bllossom-3B-gguf-Q4_K_M.gguf 파일을 다운로드합니다.

GGUF : GPT(generative pre-trained transformer) Unified Format
3. 콘솔에서 ollama create 명령어를 사용하여 llama-3.2-Korean-Bllossom-3B-gguf-Q4_K_M를 Ollama에서 사용할 수 있게 생성합니다.
ollama create llama-3.2-Korean-Bllossom-3B-gguf-Q4_K_M

모델을 Ollama 엡에서 실행하지 않기 때문에 Modelfile은 생성하지 않았습니다.
만약, Ollama 앱에서 사용할 경우에는 다운로드 폴더에 Modelfile 파일을 생성해야 합니다.
FROM llama-3.2-Korean-Bllossom-3B-gguf-Q4_K_M.gguf
TEMPLATE """{{- if .System }}
<s>{{ .System }}</s>
{{- end }}
<s>Human:
{{ .Prompt }}</s>
<s>Assistant:
"""
SYSTEM """A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions."""
PARAMETER stop <s>
PARAMETER stop </s>
다운로드 폴더에서 콘설을 실행하여 ollama create 명령어에 Modelfile을 포함하여 실행하면 됩니다.
ollama create llama-3.2-Korean-Bllossom-3B-gguf-Q4_K_M -f Modelfile
Generation (생성) – LLM (답변 생성)
1. project3에 QnA2.ipynb 파일에 Ollama로 프롬프트 실행 코드를 수정합니다.
[Code]
from langchain_ollama import ChatOllama
from langchain_core.output_parsers import StrOutputParser
model = ChatOllama(
model="llama-3.2-Korean-Bllossom-3B-gguf-Q4_K_M",
temperature=0
)
texts = "\n\n".join(result_text.page_content for result_text in result_texts)
chain = prompt | model | StrOutputParser()
response = chain.invoke({"context" : texts, "question": "중학생의 수학 기초학력 미달률은?"})
print(response)
2. Ollama 프롬프트 실행 코드를 실행합니다.

Ollama 프롬프트 실행 결과입니다.
중학생의 수학 기초학력 미달률은 13.0%입니다. 이는 고등학생 수학 기초학력 미달률(16.6%)보다 낮습니다. 수학 기초학력 부진이 가장 높아 학습 격차 해소를 위한 지원이 필요한 상황입니다.
Note: The answer is based on the provided context, which mentions that 13.0% of middle school students have a low basic math level. (참고: 답변은 제공된 맥락을 기반으로 하며, 중학교 학생의 13.0%가 기초 수학 수준이 낮다는 내용을 담고 있습니다.)
Context가 없을 경우 실행 결과입니다.
중학생의 수학 기초학력 미달률은 2019년 기준으로 약 10%에 불과하다. 이는 교육부가 발표한 데이터를 바탕으로 한 것으로, 이 데이터는 2018년부터 2020년까지의 수학 기초학력을 평가한 결과다. 이 미달률은 학생들이 수학 기초 학습을 충분히 하지 못하고 있는 것을 나타낸다.
Note: The answer is based on the provided context and may not be up-to-date or accurate for current information.
If you need more recent data, please let me know. (참고: 답변은 제공된 맥락을 기반으로 하며, 최신 정보와 일치하지 않거나 정확하지 않을 수 있습니다. 더 최신 데이터가 필요하시면 알려주세요.)
'LLM Application > LangChain' 카테고리의 다른 글
| 랭체인 - Chat Prompt Template, LCEL(LangChain Expression Language) (0) | 2026.07.26 |
|---|---|
| 랭체인 - LangChain Message (SystemMessage, HumanMessage, AIMessage) (0) | 2026.07.26 |
| LangChain - RAG + Ollama + gemma3 (0) | 2026.07.24 |
| Open Source (Local) LLM - Ollama 사용하기 (0) | 2026.07.24 |
| RAG App 개발 - Open Source 모델 사용 (0) | 2026.07.23 |