Describe the issue
Unable to convert 30B model to ONNX. I am using 4x A100's , 500GB RAM, 2.5TB Memory, still running out of memory.
To reproduce
Here's the repro:
I believe this is reproable in any container, but here's the container setup step:
- Create a container on Runpod from winglian/axolotl-runpod:main-py3.9-cu118-2.0.0
- Runpod.io -> My Templates -> New Template -> winglian/axolotl-runpod:main-py3.9-cu118-2.0.0
Then deploy 4x A100 in Secure cloud, search for the Template just created:

- Once it loads, start the terminal and:
mkdir tmp && ln -s /workspace/tmp /tmp
pip install optimum && pip install onnx && pip install onnxruntime-gpu
git lfs install
git clone https://huggingface.co/ehartford/WizardLM-30B-Uncensored
- Paste the following inference file using vim:
touch fp16_to_onnx.py
vim fp16_to_onnx.py
Paste this:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from optimum.onnxruntime import ORTModelForCausalLM
import argparse
import os
parser = argparse.ArgumentParser(description="Convert fp16 model to onnx")
parser.add_argument("model_dir", type=str, help="fp16 model folder")
parser.add_argument("--device", type=str, default="cuda:0", help="device")
args = parser.parse_args()
model_dir = args.model_dir
device = torch.device("cuda")
tokenizer = AutoTokenizer.from_pretrained(model_dir)
# model = AutoModelForCausalLM.from_pretrained(
# model_dir,
# torch_dtype=torch.float16,
# low_cpu_mem_usage=True,
# trust_remote_code=True,
# ).to(device)
save_directory = "onnx_wiz/"
print("Loading")
ort_model = ORTModelForCausalLM.from_pretrained(
model_dir, export=True).to(device)
print("Saving")
ort_model.save_pretrained(save_directory)
tokenizer.save_pretrained(save_directory)
To exit vim, Esc -> Shift + Z -> Shift + Z
- Now, run the conversion:
python fp16_to_onnx.py WizardLM-30B-Uncensored
This will take about 45 minutes, which already sounds a bit wrong as it should take 5m. gpt2 takes 30 seconds to convert.
Then , it will fail with this:
Can you please help unblock? I have been trying to convert this to ONNX for days already
Many thanks
Urgency
I am trying to scale a project an need to convert large models to ONNX, so this is time sensitive, but not critically blocking. A timely response would be much appreciated :)
Platform
Linux
OS Version
Ubuntu 22.04 LTS
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
print(ort.version) --> 1.15.0
ONNX Runtime API
Python
Architecture
X64
Execution Provider
CUDA
Execution Provider Library Version
Cuda compilation tools, release 11.8, V11.8.89 Build cuda_11.8.r11.8/compiler.31833905_0
Describe the issue
Unable to convert 30B model to ONNX. I am using 4x A100's , 500GB RAM, 2.5TB Memory, still running out of memory.
To reproduce
Here's the repro:
I believe this is reproable in any container, but here's the container setup step:
Then deploy 4x A100 in Secure cloud, search for the Template just created:

Paste this:
To exit vim, Esc -> Shift + Z -> Shift + Z
python fp16_to_onnx.py WizardLM-30B-Uncensored
This will take about 45 minutes, which already sounds a bit wrong as it should take 5m. gpt2 takes 30 seconds to convert.
Then , it will fail with this:
Can you please help unblock? I have been trying to convert this to ONNX for days already
Many thanks
Urgency
I am trying to scale a project an need to convert large models to ONNX, so this is time sensitive, but not critically blocking. A timely response would be much appreciated :)
Platform
Linux
OS Version
Ubuntu 22.04 LTS
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
print(ort.version) --> 1.15.0
ONNX Runtime API
Python
Architecture
X64
Execution Provider
CUDA
Execution Provider Library Version
Cuda compilation tools, release 11.8, V11.8.89 Build cuda_11.8.r11.8/compiler.31833905_0