{"record":{"id":"d503ce2f2ff5ee0d","repo":"huggingface/candle","slug":"unsupported-value-data-type-dt-for-name","errorCode":null,"errorMessage":"unsupported 'value' data-type {dt:?} for {name}","messagePattern":"unsupported 'value' data-type (.+?) for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"candle-onnx/src/eval.rs","lineNumber":225,"sourceCode":"        Ok(dt) => match dtype(dt) {\n            Some(dt) => {\n                if dt == DType::F32 && !t.float_data.is_empty() {\n                    Tensor::from_slice(&t.float_data, dims.as_slice(), &Device::Cpu)\n                } 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 {","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/huggingface/candle/blob/d5fee525bfde3273eb7c9b75fd2bc4937be867ca/candle-onnx/src/eval.rs#L207-L243","documentation":"get_tensor materializes an ONNX TensorProto into a candle Tensor. Both branches — a recognized data_type with no candle Tensor implementation for it, and an unrecognized numeric data_type — bail reporting the unsupported data type for the given tensor name. This happens when converting initializers or Constant-like tensors during simple_eval_.","triggerScenarios":"Calling simple_eval_ or building the initializers map on a model whose TensorProto has a data_type candle-onnx cannot materialize (unsupported enum, or a valid ONNX type with no candle conversion, e.g. string/complex/some float variants).","commonSituations":"Models with bfloat16/float8/string/complex tensors; corrupted data_type integers; exporters writing exotic dtypes; older candle versions missing newer dtype support.","solutions":["Cast the offending tensor to a supported dtype (float32/float16/int32/int64) in the source framework or via Python onnx before loading.","Re-export the model with standard dtype settings (weights in f32).","Update candle-onnx to a version supporting the dtype shown in the error.","If the number is invalid, fix the model file's data_type field with onnx.checker + manual repair."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for (name, t) in &model.graph.initializer {\n    let dt = onnx::tensor_proto::DataType::try_from(t.data_type)\n        .map_err(|_| format!(\"initializer '{name}' invalid data_type {}\", t.data_type))?;\n    assert!(matches!(dt, DataType::FLOAT | DataType::INT64 | DataType::FLOAT16), \"initializer '{name}' dtype {dt:?} unsupported\");\n}","typeGuard":"fn is_materializable(t: &onnx::TensorProto) -> bool {\n    onnx::tensor_proto::DataType::try_from(t.data_type)\n        .map(|dt| matches!(\n            dt,\n            onnx::tensor_proto::DataType::FLOAT\n                | onnx::tensor_proto::DataType::FLOAT16\n                | onnx::tensor_proto::DataType::INT32\n                | onnx::tensor_proto::DataType::INT64\n                | onnx::tensor_proto::DataType::UINT8\n                | onnx::tensor_proto::DataType::BOOL\n        ))\n        .unwrap_or(false)\n}","tryCatchPattern":"match simple_eval_(&model, inputs) {\n    Ok(outs) => outs,\n    Err(e) if e.to_string().contains(\"unsupported 'value' data-type\") => {\n        // reload a pre-cast (f32) copy of the model\n        let model = load_f32_model()?;\n        simple_eval_(&model, inputs)?\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Standardize model exports to f32 weights","Pre-cast unsupported dtypes with a Python onnx pass before Rust inference","Validate all initializers' dtypes at model-ingest time","Keep candle-onnx updated for newer dtype support"],"tags":["rust","candle","onnx","dtype","tensor"],"backgroundTag":"unsupported-dtype","analyzedSha":"d5fee525bfde3273eb7c9b75fd2bc4937be867ca","analyzedAt":"2026-09-02T00:15:47.023Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}