ONNX Model Zoo

Wanclouds/Mistral-7b-doc-ONNX

By Wanclouds · ↓ 0 · ♥ 0 · Updated 2024-02-23

What's in this repo

This page lists the files in Wanclouds/Mistral-7b-doc-ONNX, including decoder.onnx, model.onnx.

  • 2 ONNX models (.onnx files)
  • 8 files, including 3 .json, 2 .onnx, 1 .md, 1 .data
  • Last updated 2024-02-23

ONNX files

File Size Download
decoder.onnx — Download
model.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

-------------------------------------------------------------------------

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License.

--------------------------------------------------------------------------

import os from pathlib import Path

import torch import torch.distributed as dist from optimum.onnxruntime import ORTModelForCausalLM from transformers import AutoConfig, AutoTokenizer, GenerationConfig

device_id = 0 device = torch.device(f"cuda:{device_id}") # Change to torch.device("cpu") if running on CPU

ep = "CUDAExecutionProvider" # change to CPUExecutionProvider if running on CPU ep_options = {"device_id": device_id}

model_id = "mistralai/Mistral-7B-Instruct-v0.2" model_path = "./Olive/examples/llama2/models/qlora/qlora-conversion-transformers_optimization-bnb_quantization/gpu-cuda_model"

model_path = Path(model_path)

if not (model_path / "config.json").exists(): config = AutoConfig.from_pretrained(model_id) config.save_pretrained(model_path) else: config = AutoConfig.from_pretrained(model_path)

if not (model_path / "generation_config.json").exists(): gen_config = GenerationConfig.from_pretrained(model_id) gen_config.save_pretrained(model_path) else: gen_config = GenerationConfig.from_pretrained(model_path)

tokenizer = AutoTokenizer.from_pretrained(model_id)

model = ORTModelForCausalLM.from_pretrained( model_path, config=config, generation_config=gen_config, use_io_binding=True, # provider="CUDAExecutionProvider", provider=ep, provider_options={"device_id": device_id} # provider_options={"device_id": str(rank)}, )

Model info

text-generation transformers
transformers onnx mistral text-generation endpoints_compatible region:us
↓ 0 ♥ 0

Created: 2024-01-17

Updated: 2024-02-23

View on Hugging Face

Files (8)

.gitattributes
.ipynb_checkpoints/config-checkpoint.json
README.md
config.json
decoder.onnx ONNX
generation_config.json
model.onnx ONNX
model.onnx.data

Related models