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

本站现有博文333篇,共被浏览922696

本站已经建立2628天!

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