File size: 357 Bytes
7c669f0
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from transformers import AutoModelForCausalLM
import torch
import torch.utils.dlpack

# Load the original model
model_name = "./mixed_llm"
model = AutoModelForCausalLM.from_pretrained(model_name)

# Convert the model to a different precision
model = model.half()

# Save the model as a safetensor
model.save_pretrained(f"./mixed_llm_half", safetensors=True)