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

本站现有博文321篇,共被浏览764633

本站已经建立2442天!

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