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

本站现有博文328篇,共被浏览850959

本站已经建立2557天!

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