saving and loading safe tensors
While current llm model mostly uses safe tensor, we can force an existing model to save and load safe tensor by using the following command ! pip install torch ! pip install -U transformers datasets evaluate accelerate timm from transformers import AutoModelForCausalLM, AutoTokenizer model = AutoModelForCausalLM.from_pretrained( "Qwen/Qwen3.5-2B" , dtype= "auto" , device_map= "auto" ) tokenizer = AutoTokenizer.from_pretrained( "Qwen/Qwen3.5-2B" ) model_inputs = tokenizer([ "The secret to baking a good cake is " ], return_tensors= "pt" ).to(model.device) generated_ids = model.generate(**model_inputs, max_length= 30 ) tokenizer.batch_decode(generated_ids)[ 0 ] ## This is where we save the model as safe tensor model.save_pretrained( "model" , safe_serialization= True ) Then we can reload it using this code model_safe = AutoModelForCausalLM.from_pretrained( "./model" , trust_remote_code= True ) gener...