Skip to content

Error while converting the model: attempted relative import beyond top-level package #8785

@mram0509

Description

@mram0509

Trying to quantize distilbert-base-uncased-distilled-squad model using the conversion tool in Transformers library from HuggingFace.

python convert_graph_to_onnx.py --framework pt --opset 13 --pipeline question-answering --quantize --model distilbert-base-uncased-distilled-squad distilbert-base-uncased-distilled-squad_quant.onnx

The script imports the following:
import onnx
from onnxruntime.quantization import QuantizationMode, quantize

and then loads the model.

Getting this error at this point: Error while converting the model: attempted relative import beyond top-level package

Urgency
If there are particular important use cases blocked by this or strict project-related timelines, please share more information and dates. If there are no hard deadlines, please specify none.

System information

  • Windows 10
  • ONNX Runtime installed: binary
  • ONNX Runtime version:v1.8.1
  • Python version:Python 3.9.6
  • Visual Studio version (if applicable): NA
  • GCC/Compiler version (if compiling from source): NA
  • CUDA/cuDNN version: NA
  • GPU model and memory: NA

Expected behavior
Produce a quantized model

Metadata

Metadata

Assignees

No one assigned

    Labels

    quantizationissues related to quantizationstaleissues that have not been addressed in a while; categorized by a bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions