Downloads · 30 days
14
16% of all-time downloads
Yaongi/Yaongi-430M-A166M-PoC
Yaongi-430M-A166M-PoC is a text generation model from Yaongi. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
Downloads · 30 days
14
16% of all-time downloads
All-time downloads
85
Public
Repo size
1.7 GB
Likes
1
Public
Click a slice to open those files.
.pt1.7 GB · 100%
From the Hugging Face model README
⚠️ PoC only. 실제 사용 불가. | | | |---|---| |Total|430.8M| |Active|166.2M| |Layers|52|
# ========================================
# 새 Colab - 바로 실행
# ========================================
!pip install huggingface_hub sentencepiece torch -q
from huggingface_hub import snapshot_download
import sys
import torch
import sentencepiece as spm
# 다운로드
local_dir = snapshot_download("Yaongi/Yaongi-430M-A166M-PoC")
print(f"✅ 다운로드: {local_dir}")
# 모델 코드 로드
sys.path.insert(0, local_dir)
from model import HybriKo52, CFG
# 토크나이저
sp = spm.SentencePieceProcessor()
sp.load(f"{local_dir}/tokenizer.model")
# 모델 로드
device = "cuda" if torch.cuda.is_available() else "cpu"
model = HybriKo52(CFG).to(device)
model.load_state_dict(torch.load(f"{local_dir}/model.pt", map_location=device))
model.eval()
print(f"✅ 모델 로드 ({device})")
# 생성
import torch.nn.functional as F
@torch.no_grad()
def generate(prompt, max_new=50, temp=0.5, rep_penalty=1.2):
ids = torch.tensor([[2] + sp.encode(prompt)]).to(device)
for _ in range(max_new):
logits = model(ids)['logits'][:, -1, :] / temp
for t in set(ids[0].tolist()): logits[0, t] /= rep_penalty
next_id = torch.multinomial(F.softmax(logits, -1), 1)
if next_id.item() == 1: break
ids = torch.cat([ids, next_id], 1)
return sp.decode(ids[0].tolist())
# 테스트
print(generate("인공지능은"))
print(generate("대한민국"))
print(generate("서울은", max_new=150, temp=0.7, rep_penalty=1.15))
print(generate("한국어는", max_new=150))