{"record":{"id":"64d73dea600e9667","repo":"huggingface/candle","slug":"unsupported-value-data-type-for-name","errorCode":null,"errorMessage":"unsupported 'value' data-type {} for {name}","messagePattern":"unsupported 'value' data-type (.+?) for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"candle-onnx/src/eval.rs","lineNumber":229,"sourceCode":"                } else if dt == DType::F64 && !t.double_data.is_empty() {\n                    Tensor::from_slice(&t.double_data, dims.as_slice(), &Device::Cpu)\n                } else if dt == DType::I64 && !t.int64_data.is_empty() {\n                    Tensor::from_slice(&t.int64_data, dims.as_slice(), &Device::Cpu)\n                } else {\n                    Tensor::from_raw_buffer(\n                        t.raw_data.as_slice(),\n                        dt,\n                        dims.as_slice(),\n                        &Device::Cpu,\n                    )\n                }\n            }\n            None => {\n                bail!(\"unsupported 'value' data-type {dt:?} for {name}\")\n            }\n        },\n        Err(_) => {\n            bail!(\"unsupported 'value' data-type {} for {name}\", t.data_type,)\n        }\n    }\n}\n\n// This function provides a direct evaluation of the proto.\n// Longer-term, we should first convert the proto to an intermediate representation of the compute\n// graph so as to make multiple evaluations more efficient.\n// An example upside of this would be to remove intermediary values when they are not needed\n// anymore.\npub fn simple_eval(\n    model: &onnx::ModelProto,\n    mut inputs: HashMap<String, Value>,\n) -> Result<HashMap<String, Value>> {\n    let graph = match &model.graph {\n        None => bail!(\"no graph defined in proto\"),\n        Some(graph) => graph,\n    };\n    simple_eval_(graph, &mut inputs)","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/huggingface/candle/blob/d5fee525bfde3273eb7c9b75fd2bc4937be867ca/candle-onnx/src/eval.rs#L211-L247","documentation":"get_tensor parses an ONNX TensorProto initializer/attribute value into a candle Tensor. It bails when the tensor's data_type is either not representable as a candle DType (dtype(dt) returned None) or when the raw data cannot be interpreted via tensor_proto::try_from at all. The library only supports a fixed set of ONNX element types, and this model carries an initializer whose type is outside that set.","triggerScenarios":"Loading an ONNX model whose initializers include a TensorProto with an unsupported elem_type (e.g. complex64/complex128, float8 variants, string/uint4/int4), or whose raw_data field fails protobuf conversion. Raised during simple_eval_ initializer loading, during node attribute evaluation, and directly by callers of get_tensor.","commonSituations":"Models exported with newer opset types than this crate supports; quantized models with 4-bit types; models using string-tensor constants (e.g. lookup tables); mixed-precision float8 models from recent exporters.","solutions":["Inspect the failing tensor's data_type (name is printed in the message) and re-export the model with only supported dtypes (float16/float32/float64, int8/16/32/64, uint8/16/32/64, bool).","If the tensor is an optional constant, remove or replace it with a supported dtype using onnxruntime/onnx tooling.","Upgrade candle-onnx to a version that supports the required data type.","As a workaround, pre-convert the initializer externally and feed it as a named input instead of an initializer."],"exampleFix":"// before\n// model contains an initializer of type FLOAT8\n// after\n// re-export: python -c \"import onnx; ...\n#   convert unsupported init to float32 or drop it, then save model\"","handlingStrategy":"validation","validationCode":"fn init_types_supported(model: &onnx::ModelProto) -> bool {\n    model.graph.as_ref().map_or(true, |g| g.initializer.iter().all(|t| {\n        matches!(t.data_type,\n            1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13) // FLOAT..DOUBLE, BOOL, etc.\n    }))\n}","typeGuard":null,"tryCatchPattern":"match simple_eval(&model, inputs) {\n    Err(e) if e.to_string().contains(\"unsupported 'value' data-type\") => {\n        eprintln!(\"model uses an initializer dtype candle-onnx cannot load; re-export as f32/i64\");\n    }\n    other => other?,\n}","preventionTips":["Re-export models restricted to f32/i64/u8/bool dtypes","Run onnx.checker and inspect initializer dtypes before shipping a model","Keep candle-onnx updated for new dtype support","Beware quantized (int4/float8) and string-tensor models"],"tags":["onnx","dtype","unsupported-type","model-loading"],"backgroundTag":"unsupported-onnx-dtype","analyzedSha":"d5fee525bfde3273eb7c9b75fd2bc4937be867ca","analyzedAt":"2026-09-02T00:15:47.023Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}