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

本站现有博文338篇,共被浏览978145次

本站已经建立2690天!

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