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

本站现有博文328篇,共被浏览850887

本站已经建立2557天!

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