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

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

本站已经建立2578天!

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