Downloads · 30 days
14
8% of all-time downloads
sangmin6600/mamba2-400m-ko-sft
mamba2-400m-ko-sft is a machine learning model from sangmin6600. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
본 모델은 한국어 데이터로 처음부터 학습한 Mamba2 기반 소형 언어모델입니다. 자체 구축한 BPE 토크나이저를 사용했으며, 사전학습(Pretraining) 완료 후 Instruction Tuning(IT)을 통해 질의응답, 지시문 수행, 간단한 대화 작업에 적합하도록 추가 학습되었습니다.
Downloads · 30 days
14
8% of all-time downloads
All-time downloads
180
Public
Parameters
396M
792 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors792 MB · 100%
From the Hugging Face model README
본 모델은 한국어 데이터로 처음부터 학습한 Mamba2 기반 소형 언어모델입니다.
자체 구축한 BPE 토크나이저를 사용했으며, 사전학습(Pretraining) 완료 후 Instruction Tuning(IT)을 통해 질의응답, 지시문 수행, 간단한 대화 작업에 적합하도록 추가 학습되었습니다.
본 모델 개발 이후, 약 7B 규모의 Mamba2 아키텍처 확장을 시도했습니다.
그러나 학습 과정에서 activation 메모리 사용량이 매우 크게 증가하여 학습이 불가능했습니다.
특히 Mamba 계열 모델은 Transformer 구조와 달리 selective scan 기반의 state-space 연산을 사용하며,
학습 시 backward pass를 위해 더 많은 중간 activation을 보존해야 합니다.
이로 인해 동일 파라미터 규모의 Transformer 대비 activation memory overhead가 더 크게 발생했습니다.
Fully Sharded Data Parallel (FSDP), Activation Checkpointing, 8bit-optimizer, 입력 길이 8K 제한을 적용해도 80GB VRAM GPU x 4 환경에서 OOM 문제가 해결되지 않았으며, 대규모 mamba모델 학습은 추가적인 시스템 자원 또는 구조적 개선이 필요하다는 결론에 도달했습니다.
<!-- ## Model Details --> <!-- ### Model Description --> <!-- Provide a longer summary of what this model is. --> <!-- - **Developed by:** [More Information Needed] - **Funded by [optional]:** [More Information Needed] - **Shared by [optional]:** [More Information Needed] - **Model type:** [More Information Needed] - **Language(s) (NLP):** [More Information Needed] - **License:** [More Information Needed] - **Finetuned from model [optional]:** [More Information Needed] --> <!-- ### Model Sources [optional] --> <!-- Provide the basic links for the model. --> <!-- - **Repository:** [More Information Needed] - **Paper [optional]:** [More Information Needed] - **Demo [optional]:** [More Information Needed] -->python, cuda, torch 버전에 맞는 causal-conv1d, mamba_ssm 설치
pip install causal-conv1d
pip install mamba-ssm
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "sangmin6600/mamba2-400m-ko-sft"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16).to("cuda")
inputs = [
# {"role": "system", "content": "..."},
{"role": "user", "content": "인공지능 언어 모델이 뭐야?"},
]
text = tokenizer.apply_chat_template(inputs, tokenize=False, add_generation_prompt=True)
input_ids = tokenizer(text, return_tensors="pt")['input_ids'].to("cuda")
output_ids = model.generate(input_ids, max_new_tokens=2048, do_sample=True)
print(tokenizer.decode(output_ids[0], skip_special_tokens=True))
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
<!-- [More Information Needed] -->
[More Information Needed]
[More Information Needed]
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
Use the code below to get started with the model.
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]