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

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

本站已经建立2602天!

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