@tqchen, @nhynes
For the frontend, I’m writing an end-to-end example. When I get the load_params from graph runtime module and trying to feed the bytearray of params, I get the Invalid parameters file format from here or here.
Precisely, I read the params as follows
let params: Vec<u8> = fs::read("deploy_param.params")?; // <-- bytearray
let params = TVMByteArray::from(¶ms); // <-- convert to TVMByteArray
then I convert the params to TVMValue with v_handle and feed into load_params function which resulted in the same above error.
I followed this, though I guess I don’t know how params are serialized.
Also in java example, there’s no alignment, could this be the reason?
What’s the correct way of reading the params? endianness? and what reserved is about in CHECK(strm->Read(&reserved))?
Thanks Nick! but was hoping for now, I won’t need the graph runtime support in Rust frontend (?) since I’m getting and invoking packed global functions separately in the stack-wise manner. So gaph.json is loaded first then the bytearray params.
I’m confused. Basically, aren’t feeding graph as String and params as TVMByteArray enough?! at least this is what java frontend is doing! @nhynes@tqchen@yzhliu
Have you verified that you can round-trip your params using the python or C++ API? Assuming so, the likely cause is that your pointers aren’t going to the right places in the TVMByteArray. I looked for your impl From<Vec<u8>> for TVMByteArray but couldn’t find anything, so I couldn’t debug further.
I would recommend using rust-gdb to debug which C++ method is failing.
Thanks for looking into the code! I just pushed the changes so please pull from tvm-rust and checkout the resnet branch where I put the example. TVMByteArray is in the ndarray.rs for now. Testing the model artifacts build seems ok from python. I’ve tried different things for Vec<u8> to TVMByteArray conversions.
Found the issue finally! It’a actually not related to TVMByteArray. The pointer invalidation when the function was freed causes this behavior in the builder pattern.