Downloads · 30 days
240
49% of all-time downloads
idah4/etm-korean-tiny
etm-korean-tiny is a text generation model from idah4. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
소형 텍스트 디코더 LM - 200 MB causal LM trained on Korean web text. - 학습 데이터: beomi/kowikitext-qa-ref-detail-preview, HAERAE-HUB/KOREAN-WEBTEXT 일부 - HAERAE-HUB/KOREAN-WEBTEXT 데이터셋 기준: traince 4.934 | valce 4.835 | valppl 125…
Downloads · 30 days
240
49% of all-time downloads
All-time downloads
486
Public
Parameters
49.9M
599 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors200 MB · 99%
From the Hugging Face model README
소형 텍스트 디코더 LM
# %% ETM Inference
import torch
from transformers import AutoModelForCausalLM
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/polyglot-ko-1.3b")
# 1️⃣ 모델 로드
repo_id = "idah4/etm-korean-tiny"
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = AutoModelForCausalLM.from_pretrained(
repo_id,
trust_remote_code=True
).to(device).eval()
def encode(text):
return torch.tensor(
tokenizer(text)["input_ids"],
dtype=torch.long
).unsqueeze(0).to(device)
def decode(ids):
return tokenizer.decode(ids.tolist(), skip_special_tokens=True)
# 3️⃣ 텍스트 생성 함수
@torch.no_grad()
def generate_text(prompt: str,
temperature=0.8,
top_k=40,
top_p=0.95,
repetition_penalty=2.0,
max_new_tokens=100,):
input_ids = encode(prompt)
out = model.generate(
input_ids,
max_new_tokens=max_new_tokens,
temperature=temperature,
top_k=top_k
)
text_out = decode(out[0])
return text_out
# 4️⃣ 시연
# 4️⃣ 시연
prompt = "나: 나는 사람이야. 너는 정체가 뭐니?\n너:"
result = generate_text(
prompt,
max_new_tokens=40,
temperature=0.7,
top_k=32,
top_p=0.9,
repetition_penalty=1.1
)
print("📝 Prompt:", prompt)
print("💬 Generated:\n", result)
📝 Prompt: 나: 나는 사람이야. 너는 정체가 뭐니?
너:
💬 Generated:
나: 나는 사람이야. 너는 정체가 뭐니?
너:
이런 말� 들은 일은 없다. 그들이 원하는 일, 즉 그렇게 당신의 삶에 대한 질문이 있었어요
“내 마음은 좋고, 그래서 좋겠