Views
No views yet
1from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
2
3# Configure quantization
4quant_config = BitsAndBytesConfig(
5 load_in_4bit=True,
6 bnb_4bit_compute_dtype="float16",
7 bnb_4bit_use_double_quant=True,
8 bnb_4bit_quant_type="nf4"
9)
10
11# Load the model with quantization
12model_name = "speakleash/Bielik-11B-v2.3-Instruct"
13model = AutoModelForCausalLM.from_pretrained(
14 model_name,
15 quantization_config=quant_config,
16 device_map="auto"
17)
18
19# Load the tokenizer
20tokenizer = AutoTokenizer.from_pretrained(model_name)
21
22# Save the model and tokenizer
23save_directory = "./quantized_model"
24model.save_pretrained(save_directory)
25tokenizer.save_pretrained(save_directory)@misc{Bielik11Bv2b,
title = {Bielik-11B-v2 model card},
author = {Ociepa, Krzysztof and Flis, Łukasz and Wróbel, Krzysztof and Gwoździej, Adrian and {SpeakLeash Team} and {Cyfronet Team}},
year = {2024},
url = {https://huggingface.co/speakleash/Bielik-11B-v2},
note = {Accessed: 2024-08-28},
urldate = {2024-08-28}
}
@unpublished{Bielik11Bv2a,
author = {Ociepa, Krzysztof and Flis, Łukasz and Kinas, Remigiusz and Gwoździej, Adrian and Wróbel, Krzysztof},
title = {Bielik: A Family of Large Language Models for the Polish Language - Development, Insights, and Evaluation},
year = {2024},
}
@misc{ociepa2024bielik7bv01polish,
title={Bielik 7B v0.1: A Polish Language Model -- Development, Insights, and Evaluation},
author={Krzysztof Ociepa and Łukasz Flis and Krzysztof Wróbel and Adrian Gwoździej and Remigiusz Kinas},
year={2024},
eprint={2410.18565},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2410.18565},
}