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

本站现有博文340篇,共被浏览1019277次

本站已经建立2719天!

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