EADST

Merge Safetensors to Bin File

Merge Safetensors to Bin File

from safetensors.torch import load_file
import torch
import os

safetensors_dir = "./your_model_folder_path/"

# get the number of safetensors
number = 0
for root, _, files in os.walk(safetensors_dir):
    for file in files:
        if "-of-" in file:
            number = file.split("-of-")[-1].strip(".safetensors")
            break

# merge safetensors to bin
model_data = {}
for i in range(1, int(number)+1):
    file_path = os.path.join(safetensors_dir, f"model-0000{i}-of-{number}.safetensors")
    data = load_file(file_path)
    model_data.update(data)

# save bin
torch.save(model_data, "./your_model_folder_path/pytorch_model.bin") 
相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
Github 多进程 XGBoost Input Land 飞书 音频 v0.dev Disk Tiktoken Docker 算法题 uwsgi CTC Bert Website GPT4 Web Statistics Math LaTeX RGB Conda 关于博主 Jetson CSV Plotly DeepSeek Augmentation SPIE llama.cpp Baidu FP32 Heatmap Translation logger Data Knowledge Vmess Quantization FP16 Plate Ptyhon PIP Permission 论文速读 Markdown 继承 icon scipy BeautifulSoup VPN PyCharm Animate FP8 mmap Distillation Pandas Bitcoin Nginx COCO Search 财报 TensorFlow OpenAI Video Use Logo 公式 云服务器 UI AI Color 图形思考法 Firewall Qwen tar Windows Cloudreve VGG-16 printf Food VSCode Agent News EXCEL LeetCode Qwen2 Diagram Pytorch 腾讯云 SQL hf Attention GGML Quantize ResNet-50 CAM QWEN ModelScope Claude API Ubuntu Hotel RL v2ray InvalidArgumentError BF16 PDF XML Paper NameSilo HaggingFace OpenCV Paddle 第一性原理 Miniforge uWSGI MD5 强化学习 LLM OCR Google diffusers HuggingFace Numpy Crawler 搞笑 递归学习法 Hilton 图标 Linux 论文 git Gemma 证件照 Image2Text Template Qwen2.5 Vim CEIR Algorithm Streamlit ChatGPT PyTorch Dataset NLP Interview Anaconda Breakpoint Llama Safetensors Card git-lfs CLAP Password C++ Hungarian transformers 净利润 Magnet ONNX ms-swift BTC FastAPI SAM 签证 SVR CV 域名 DeepStream LLAMA Git Datetime CC Pickle Tensor Bipartite IndexTTS2 Python NLTK GIT FlashAttention YOLO Domain Bin CUDA JSON Base64 Rebuttal Michelin Tracking Review tqdm WebCrawler GPTQ torchinfo UNIX Clash 多线程 GoogLeNet Django 阿里云 TSV 顶会 版权 Zip Shortcut TensorRT WAN RAR LoRA Random Pillow Sklearn SQLite PDB TTS Transformers Freesound 报税 Proxy Jupyter Mixtral FP64 Excel
站点统计

本站现有博文332篇,共被浏览876114

本站已经建立2583天!

热门文章
文章归档
回到顶部