Instructions to use sjmoon21/SJ-ko with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use sjmoon21/SJ-ko with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf sjmoon21/SJ-ko # Run inference directly in the terminal: llama cli -hf sjmoon21/SJ-ko
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf sjmoon21/SJ-ko # Run inference directly in the terminal: llama cli -hf sjmoon21/SJ-ko
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf sjmoon21/SJ-ko # Run inference directly in the terminal: ./build/bin/llama cli -hf sjmoon21/SJ-ko
Use Docker
docker model run hf.co/sjmoon21/SJ-ko
- Llama new
- LM Studio
- Jan
- vLLM
How to use sjmoon21/SJ-ko with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sjmoon21/SJ-ko" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sjmoon21/SJ-ko", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/sjmoon21/SJ-ko
- Ollama
How to use sjmoon21/SJ-ko with Ollama:
ollama run hf.co/sjmoon21/SJ-ko
- Unsloth Desktop
- Docker Model Runner
How to use sjmoon21/SJ-ko with Docker Model Runner:
docker model run hf.co/sjmoon21/SJ-ko
- Lemonade
How to use sjmoon21/SJ-ko with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull sjmoon21/SJ-ko
Run and chat with the model
lemonade run user.SJ-ko-{{QUANT_TAG}}List all available models
lemonade list
- Atomic Chat
SJ-0.5.6simf — facts + arithmetic + multi-turn SFT
Browse filesFiles changed (5)
- .gitattributes+1
- Modelfile+1-7
- README.md+41-7
- serve_ollama.py+31
- sj-0.5.6simf.ggufAdded+3
33 unmodified lines34353633 unmodified lines*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textsj-0.5.1si.gguf filter=lfs diff=lfs merge=lfs -text33 unmodified lines3435363733 unmodified lines*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textsj-0.5.1si.gguf filter=lfs diff=lfs merge=lfs -textsj-0.5.6simf.gguf filter=lfs diff=lfs merge=lfs -text
123456789101112FROM ./sj-0.5.1si.gguf# 다중 턴: .Messages를 순회해 <|user|>q<|assistant|>a<|endoftext|> 로 이어붙인다.# raw:true 로 직접 조립하면 특수 토큰이 문자열로 취급되므로 반드시 템플릿을 써야 한다.TEMPLATE """{{- range .Messages }}{{- if eq .Role "user" }}<|user|>{{ .Content }}<|assistant|>{{- else }}{{ .Content }}<|endoftext|>{{- end }}{{- end }}"""# 이게 없으면 답변이 끝나도 멈추지 않는다.PARAMETER stop "<|endoftext|>"PARAMETER temperature 0.7PARAMETER top_k 50PARAMETER repeat_penalty 1.2123456FROM ./sj-0.5.6simf.ggufTEMPLATE """{{- range .Messages }}{{- if eq .Role "user" }}<|user|>{{ .Content }}<|assistant|>{{- else }}{{ .Content }}<|endoftext|>{{- end }}{{- end }}"""PARAMETER stop "<|endoftext|>"PARAMETER temperature 0.7PARAMETER top_k 50PARAMETER repeat_penalty 1.2
13 unmodified lines1415161718192013 unmodified lines3435363738394041424344454615 unmodified lines62636465666768699 unmodified lines798081828384858687888912 unmodified lines10210310413 unmodified lines# SJ-koAn 11M parameter Korean GPT built and trained from scratch.Current release: `SJ-0.5.1si` (`sj-0.5.1si.gguf`).No Hugging Face Transformers, no existing training framework. The BPE tokenizer,attention, training loop, and GGUF converter were all written by hand. This is an13 unmodified lines| Vocabulary | 5,208 (character-level BPE trained from scratch; digits kept as single tokens) || Hardware | MacBook Air M1 (MPS) || Pre-training | 160.6M tokens × 2.03 epochs · 18.9 hours || SFT | 40,119 pairs × 3.01 epochs · 10.8 hours |## Usage (Ollama)```bashollama create sj-0.5.1si -f Modelfileollama run sj-0.5.1si```The bundled `Modelfile` carries two settings that are required. Without them the15 unmodified lines```bashOLLAMA_HOST=127.0.0.1:11434 ollama serve &ollama create sj-0.5.1si -f Modelfilepython3 serve_ollama.py --model sj-0.5.1si --host 0.0.0.0 --port 3000```Keep Ollama bound to localhost. Its API has no authentication and allows model9 unmodified lines| [wikimedia/wikipedia](https://huggingface.co/datasets/wikimedia/wikipedia) 20231101 ko·en (CC BY-SA) | 37.8% || Synthetic arithmetic, generated in Python with guaranteed-correct answers | 5.0% |Supervised fine-tuning (40,119 pairs)| Source | Count ||---|---|| AI Hub, 121.한국어 성능이 개선된 초거대AI 언어모델 개발 및 데이터 (RLHF) | 32,275 || Synthetic multi-turn (4,000 concatenated pairs + 908 follow-up turns generated by DeepSeek) | 4,908 || Synthetic arithmetic question-answer pairs | 2,000 || Synthetic identity pairs | 936 |12 unmodified linesMIT for the model weights. The terms of the original training data remain withtheir respective providers.13 unmodified lines141516171819202113 unmodified lines3536373839404142434445464715 unmodified lines63646566676869709 unmodified lines80818283848586878889909112 unmodified lines10410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813 unmodified lines# SJ-koAn 11M parameter Korean GPT built and trained from scratch.Current release: `SJ-0.5.6simf` (`sj-0.5.6simf.gguf`).The previous release `sj-0.5.1si.gguf` is kept in the repository.No Hugging Face Transformers, no existing training framework. The BPE tokenizer,attention, training loop, and GGUF converter were all written by hand. This is an13 unmodified lines| Vocabulary | 5,208 (character-level BPE trained from scratch; digits kept as single tokens) || Hardware | MacBook Air M1 (MPS) || Pre-training | 160.6M tokens × 2.03 epochs · 18.9 hours || SFT | 47,319 pairs × 2.99 epochs · 5.8 hours |## Usage (Ollama)```bashollama create sj-0.5.6simf -f Modelfileollama run sj-0.5.6simf```The bundled `Modelfile` carries two settings that are required. Without them the15 unmodified lines```bashOLLAMA_HOST=127.0.0.1:11434 ollama serve &ollama create sj-0.5.6simf -f Modelfilepython3 serve_ollama.py --model sj-0.5.6simf --host 0.0.0.0 --port 3000```Keep Ollama bound to localhost. Its API has no authentication and allows model9 unmodified lines| [wikimedia/wikipedia](https://huggingface.co/datasets/wikimedia/wikipedia) 20231101 ko·en (CC BY-SA) | 37.8% || Synthetic arithmetic, generated in Python with guaranteed-correct answers | 5.0% |Supervised fine-tuning (47,319 pairs)| Source | Count ||---|---|| AI Hub, 121.한국어 성능이 개선된 초거대AI 언어모델 개발 및 데이터 (RLHF) | 32,275 || Synthetic atomic-fact question-answer pairs (900 facts × 8 phrasings, generated by DeepSeek) | 7,200 || Synthetic multi-turn (4,000 concatenated pairs + 908 follow-up turns generated by DeepSeek) | 4,908 || Synthetic arithmetic question-answer pairs | 2,000 || Synthetic identity pairs | 936 |12 unmodified linesMIT for the model weights. The terms of the original training data remain withtheir respective providers.## Training historyEvery run from the first character-level bigram to the current release. Loss perchar (nats per character) is the only column comparable across runs — token lossdepends on the tokenizer, which changed several times. Notes are the author's ownworking notes, in Korean.| Run | Version | Method | Data | Train tokens | Epochs | Wall clock | Params | Tokens/param | Loss per char | Notes (Korean) ||---||---||---||---||---||---||---||---||---||---||---|| run01 | 0.1.0p | pre-training | 커뮤니티 크롤링 298만자 | 2.84M | 6.5 | 54분 | 5.45M | 3.39 | - | 크롤링 데이터 기반 pre-training. char-level tokenize. clien 데이터가 대부분이라, 커뮤니티 말투이긴 한데 아저씨 말투여서 실패. 추가로, char-level이어서 인지 한자가 너무 많이 등장하는 문제도 존재. step 3000/6000에서 수동 중단 || run02 | 0.2.0p | pre-training | 웹소설 716만자 | 6.80M | 4.2 | 94.8분 | 5.22M | 5.47 | 2.1032 | 전지적 독자 시점, 재벌집 막내아들, 나 혼자만 레벨업 3권 데이터 활용. char-level tokenized. val split이 전독시 후반부에 갇혀 격차가 −0.15로 편향된 결함 발견 || run03 | 0.2.1p | pre-training | 웹소설 714만자 | 3.75M | 4.10 | 51.6분 | 5.82M | 2.64 | 2.3095 | BPE tokenizer로 변경(vocab 4096). 웹 소설 문체여서 대괄호나 너무 고유명사들이 많이 나오는 문제가 있었음. 데이터 교체필요. 회차 단위 분할 + `<\ || run04 | 0.3.0p | pre-training | AI hub 도서 1.79억자 | 91.4M | 1.01 | 312.7분 | 6.15M | 15.01 | 2.2369 | AI hub 도서 데이터 도입(vocab 5366). 영어, 기호 아예 존재하지 않는 문제 있음. 문단이 저작권 보호로 무작위 섞여 있어 논리 전개 학습 불가. 참고문헌 음차 오염 1.7%. 영문/한글 위키 도입 예정 || run05 | 0.3.1s | sft | AI hub RLHF 21,650쌍 | 6.30M | 1.04 | 58.7분 | 6.25M | 1.05 | 1.5161 (sft) | 첫 sft 진행. 나름 성공적 — EOT 학습 성공(질문 유형별 길이 조절까지). 첫 gguf 파일 생성, `ollama run` 확인. bias 이슈로 인한 변환 과정 약 3% 손실 || run06 | 0.3.2si | sft-identity | SFT + 정체성 350쌍 | 6.31M | 1.04 | 66.5분 | 6.25M | 1.05 | 1.4776 (sft) | 모델 정체성 주입 시도했지만 실패. 고유 쌍당 노출이 적어 실패한 것으로 확인 || run07 | 0.3.3si | sft-identity | SFT + 정체성 1,170쌍 | 6.33M | 1.00 | 59.8분 | 6.25M | 1.01 | 1.4762 (sft) | 모델 정체성 주입 2트. 사본을 늘려 노출 횟수 증가. 과잉발화 문제가 ���기는 함 || run08 | 0.4.0p | pre-training | AI hub 도서 + 한/영 위키 2.96억자 | 146.9M | 1.00 | 319.2분 | 6.10M | 24.08 | 2.0069 | 6층 구조. 음차 제거, 위키로 영어와 기호 확보, vocab은 오히려 감소(압축률 증가), bias false로 변경해서 gguf에서 손실 나지 않도록 조치. || run09 | 0.4.1si | sft-identity | SFT 33,741쌍 + 정체성 936쌍 | 10.49M | 3.05 | 87.4분 | 6.20M | 5.16 | 1.2665 (sft) | 6층 구조 identity 포함 sft. 영문, 기호가 포함되었기 때문에 활용 가능한 SFT 쌍이 증가. 정체성은 사본 6개 x 3 epoch로 노출 18회. || run10 | 0.4.2p | pre-training | AI hub 도서 + 한/영 위키 2.96억자 | 146.9M | 1.00 | 318.8분 | 6.16M | 23.85 | 1.9529 | 6층 구조. minimind 참고하여 RoPE 적용한 v2 아키텍쳐 도입. run08과 데이터는 동일 || run11 | 0.4.3si | sft-identity | SFT 33,741쌍 + 정체성 936쌍 | 10.49M | 1.99 | 43.0분 | 6.16M | 3.39 | 1.2602 (sft) | v2 아키텍쳐 적용 identity 포함 sft. gguf 생성 엔진 수정 || run12 | 0.4.4p | pre-training | AI hub 도서 + 한/영 위키 2.96억자 | 146.9M | 1.00 | 400.2분 | 10.97M | 13.39 | 1.8823 | 12층 v2 아키텍쳐 모델. 층수 증가로 인한 파라미터 증가. 파라미터 +78%인데 시간은 +26% || run13 | 0.4.5si | sft-identity | SFT 33,741쌍 + 정체성 936썽 | 10.49M | 2.70 | 161.2분 | 10.98M | 2.58 | 1.1243 (sft) | v2 아키텍쳐 적용 12층 sft. 과잉발화 문제 완화. 조기종료 || run14 | 0.5.0p | pre-training | AI hub 도서 + 한/영 위키 + 합성 산술 3.10억자 | 160.6M | 2.03 | 1,133.8분 | 10.97M | 29.72 | 1.7796 | 숫자 한 자리씩 토크나이징 + 합성 산술 5% 도입. block 128→256. 프롬프트가 \n으로 시작할 때만이기는 하지만 4자리 덧셈 받아올림 완주 100% || run15 | 0.5.1sim | sft-identity | SFT 32,275 + 정체성 936 + 다중턴 4,908 + 산술 2,000 | 13.1M | 3.01 | 645.2분 | 10.97M | 3.59 | 1.0948 (sft) | 다중 턴 도입 성공. 기존에는 처음 물은 질문에 관한 답변만 제공하던 문제 해결. 기존 SFT 데이터셋에서 답변=질문인 데이터셋 발견 후 수정. 산술 문답 데이터 적용. RoPE 도입 후 부작용 없는 block 증가 || run16 | 0.5.2d | dpo | on-policy DPO 2,435쌍 (rep<=1) | 1.76M | 1.00 | 31.7분 | 10.97M | 0.16 | - | DPO 첫 시도. 반복 감소를 목표. 하지만 모든 지표 악화(반복률 10.6→20.0%, 길이 374→572자, EOT 97→87.6%, unk 25.6→39.4%. 정체성 완전 소실, 토큰 파괴) || run17 | 0.5.3d | dpo | on-policy DPO 2,435쌍 (rep<=1) | 1.76M | 1.00 | 31.5분 | 10.97M | 0.16 | - | β를 5배로. 마진 억제, 정체성 보존. 그러나 반복률 22.4%로 최악. 토큰 파괴는 잔존 || run18 | 0.5.4d | dpo | on-policy DPO 2,435쌍 (rep<=1) | 1.76M | 1.00 | 32.4분 | 10.97M | 0.16 | - | 마진 36으로 가장 잘 묶임. 셋 중 제일 낫지만 원본보다는 나쁨. DPO 결론: β 문제가 아니라 데이터 구조 문제. 긴 내용 선호로 바뀌면서 채울 내용이 없어 반복으로 떼운 듯 || run19 | 0.5.5sf | sft-facts | 사실 QnA 7,200 + 정체성 936 | 0.14M | 2.95 | 44.0분 | 10.97M | 0.04 | 0.1276 (sft) | run15 위에 추가로 sft 얹은 방식. deepseek 생성 사실 900개를 질문 8가지씩 SFT. 훈련에 안 쓴 표현으로 물어도 핵심어 44.3% / 완전 일치 29.0% (이전 8.0% / 0.0%). 하지만, 산술 10/20 → 0/20, 일반 서술 답변이 한 문장으로 붕괴. 전체 sft 재실행 예정 || run20 | 0.5.6simf | sft-full | SFT 32,275 + 정체성 936 + 다중턴 4,908 + 산술 2,000 + 사실 7,200 | 13.1M | 2.99 | 349.1분 | 10.97M | 3.56 | 1.0549 (sft) | run19의 대량 망각을 사실 비중 88%→15.2%로 낮춰 해결. 길이 버킷팅(풀 단위 정렬) 도입으로 12.7시간→5.8시간. 남은 결함은 사실 간 혼선(한라산 답에 독도 설명이 붙음)과 다중 턴 내용 붕괴. || run21 | 0.5.7p | pre-training(이어서) | AI hub 도서 + 한/영 위키 + 합성 산술 3.10억자 | 160.6M | 0.19 | 151.6분 | 10.97M | 2.80 | 1.7375 | run14에서 이어서 문맥 256→512. 복사 능력 전 구간 개선되었지만 RAG 사용 가능 수준에는 미달 → 문맥 1024로 다시 pre-training 예정 || run22 | 0.6.0p | pre-training | 나무위키 + AI hub 도서 + 한/영 위키 + 합성 산술 7.64억자 | 353.6M | 1.20 | (진행 중) | 22.34M | 19.0 | (진행 중) | 나무위키 도입 + 토크나이저 v4 + 22M 확장. 코퍼스 3.10→7.64억자(나무위키 33.6% / 도서 24.1% / 영문위키 22.1% / 한국어위키 17.5% / 산술 2.7%, 한국어 75.2%). vocab 5,206→14,241로 자/토큰 1.881→2.107, unk 0.320→0.054%. 문맥 256→1024, 12층 d256→14층 d320 |
215 unmodified lines21621721821922022149 unmodified lines27127227327427527613 unmodified lines2902912922932942951 unmodified line297298299300301302215 unmodified linesreturn Trueclass H(BaseHTTPRequestHandler):protocol_version = 'HTTP/1.1'49 unmodified lines{"Content-Type": "application/json"})t0 = time.time()got = 0try:up = urllib.request.urlopen(rq, timeout=180)except urllib.error.URLError:13 unmodified linesexcept ValueError:continuepiece = (d.get('message') or {}).get('content', '')if piece:chunk = piece.encode()self.wfile.write(b"%x\r\n" % len(chunk) + chunk + b"\r\n")1 unmodified linegot += len(piece)if d.get('done'):breakself.wfile.write(b"0\r\n\r\n")except (BrokenPipeError, ConnectionResetError):pass # 사용자가 창을 닫은 경우215 unmodified lines21621721821922022122222322422522622722822923023123223323423523623723823949 unmodified lines28929029129229329429513 unmodified lines3093103113123133143153163173183193203211 unmodified line323324325326327328329330331332333215 unmodified linesreturn TrueUNK = "<unk>"def strip_unk(buf, last):"""buf에서 <unk>를 지우고 (내보낼 것, 남길 꼬리)를 돌려준다.스트림 조각이 "<un" 에서 끊길 수 있으므로, <unk>의 접두사가 될 수 있는꼬리는 내보내지 않고 다음 조각까지 들고 있는다. last=True면 전부 비운다."""buf = buf.replace(UNK, '')if last:return buf, ''for k in range(len(UNK) - 1, 0, -1): # "<unk" "<un" "<u" "<"if buf.endswith(UNK[:k]):return buf[:-k], buf[-k:]return buf, ''class H(BaseHTTPRequestHandler):protocol_version = 'HTTP/1.1'49 unmodified lines{"Content-Type": "application/json"})t0 = time.time()got = 0buf = ''try:up = urllib.request.urlopen(rq, timeout=180)except urllib.error.URLError:13 unmodified linesexcept ValueError:continuepiece = (d.get('message') or {}).get('content', '')# Ollama의 options에는 특정 토큰을 막는 항목이 없다. GGUF 어휘에# <unk>가 그대로 있어서 그게 글자로 흘러나온다 — 여기서 지운다.# 토큰 경계와 스트림 조각 경계가 다르므로 꼬리를 물고 있는다.if piece:buf += pieceout, buf = strip_unk(buf, last=False)piece = outif piece:chunk = piece.encode()self.wfile.write(b"%x\r\n" % len(chunk) + chunk + b"\r\n")1 unmodified linegot += len(piece)if d.get('done'):breaktail, _ = strip_unk(buf, last=True) # 남은 꼬리를 비운다if tail:chunk = tail.encode()self.wfile.write(b"%x\r\n" % len(chunk) + chunk + b"\r\n")got += len(tail)self.wfile.write(b"0\r\n\r\n")except (BrokenPipeError, ConnectionResetError):pass # 사용자가 창을 닫은 경우
123version https://git-lfs.github.com/spec/v1oid sha256:02016fbf50d3f23efe13e81fb9b87e44f8ea4d8c1d51c0c704a99b35fbe6d0a3size 50148448.gitattributes+1
Modelfile+1-7
README.md+41-7
serve_ollama.py+31
sj-0.5.6simf.ggufAdded+3