Views
No views yet
1from unsloth import FastLanguageModel
2
3# 1. Point model_name directly to this Hugging Face repository!
4# Unsloth will automatically read the config and load the base model together with the LoRA.
5LORA_DIR = "CTCT-CT2/Changeway-Qwen3.6-27B-LoRA-V1"
6
7model, tokenizer = FastLanguageModel.from_pretrained(
8 model_name = LORA_DIR,
9 max_seq_length = 8192,
10 dtype = None,
11 load_in_4bit = False, # Note: It is best to disable 4bit when merging, load in 16bit mode
12 device_map = "auto", # [!] Let it automatically take over or force allocation
13)
14
15# 2. Merge the LoRA into the Base model and save as a new full model
16MERGED_DIR = "./qwen-27b-cybersec-merged"
17print(f"Merging and saving to {MERGED_DIR} ...")
18
19model.save_pretrained_merged(MERGED_DIR, tokenizer, save_method="merged_16bit")
20print("Merge completed successfully!")
21