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

本站现有博文335篇,共被浏览937517

本站已经建立2648天!

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