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

本站现有博文316篇,共被浏览746748

本站已经建立2394天!

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