Image Diffusion block merging technique applied to transformers based Language Models.
Python
55
25 commits
updated May 8, 2023
Image Diffusion block merging technique applied to transformers based Language Models.
A basic python install with Transformers and Pytorch.
[On Linux] python ./LM_BlockMerge.py
[On Windows] python LM_BlockMerge.py
"./this/is/your/chosen_path/" + "/converted_model"The script will then load the weights in memory, according to the precision (32/16 bit) chosen in the configuration header, and will subsequently prompt the user with a popup GUI listing all of the layers available in the selected models.
The layers will be merged according to the individual choices per layer, and the resulting model weights will be saved onto the output folder, alongside the first model's config.json file.
fp16 = False # Perform operations in fp16. Saves memory, but CPU inference will not be possible.
always_output_fp16 = True # If true, will output fp16 even if operating in fp32
max_shard_size = "2000MiB" # Set output shard size
verbose_info = True # Will show model information when loading
force_cpu = True # Only use cpu
Supported Models:
Pseudo-Supported Models:
Notes:
To Do:
Co-wrote current LM block merge implementation:
Original script implementation (Average weights merge):
Image Diffusion block merging technique applied to transformers based Language Models.
Python
55
25 commits
updated May 8, 2023
Image Diffusion block merging technique applied to transformers based Language Models.
A basic python install with Transformers and Pytorch.
[On Linux] python ./LM_BlockMerge.py
[On Windows] python LM_BlockMerge.py
"./this/is/your/chosen_path/" + "/converted_model"The script will then load the weights in memory, according to the precision (32/16 bit) chosen in the configuration header, and will subsequently prompt the user with a popup GUI listing all of the layers available in the selected models.
The layers will be merged according to the individual choices per layer, and the resulting model weights will be saved onto the output folder, alongside the first model's config.json file.
fp16 = False # Perform operations in fp16. Saves memory, but CPU inference will not be possible.
always_output_fp16 = True # If true, will output fp16 even if operating in fp32
max_shard_size = "2000MiB" # Set output shard size
verbose_info = True # Will show model information when loading
force_cpu = True # Only use cpu
Supported Models:
Pseudo-Supported Models:
Notes:
To Do:
Co-wrote current LM block merge implementation:
Original script implementation (Average weights merge):