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

本站现有博文320篇,共被浏览756562

本站已经建立2420天!

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