Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Summary
config 설정을 통해 bits and bytes 패키지로 양자화를 할 수 있도록 기능을 추가하였습니다.
✅ Checklist
[ ] 문서 업데이트가 포함되었습니다.📄 Description
config.yaml
에 bnb 설정이 추가되었습니다.4bit 및 8bit 양자화를 할 수 있으며, 4bit 양자화 시 세부 로직을 선택할 수 있습니다.
inference.py
에서도 양자화 설정을 통해 기 학습된 모델을 불러오게 하였습니다.💡 Notice (Optional)
from_pretrained
로 모델을 불러올 때BitsAndBytesConfig
객체를quantization_config
로 넣으면 양자화 설정이 로드되며 학습 속도가 느려지는 현상을 발견하였습니다.따라서,
load_model
함수에서load_in_4bit
혹은load_in_8bit
둘 중 하나가 True 인 경우(양자화가 필요한 경우) 에만 quantization_config 객체를 만들도록 하였습니다.(없다면 None을 넣어 평범하게 모델을 불러와 학습 속도에 영향을 주지 않습니다.)추가적으로 torch_dtype도 config에서 수정가능하게 파라미터화 시켰습니다.
🔗 Related Issue(s)
#23