dmlc / dmlc/tl2cgen

segfault when try to run export_srcpkg example

Open
#37 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
55
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Hi. I am trying to run the example here https://tl2cgen.readthedocs.io/en/latest/treelite-migration.html but run into segfault when try to export the source package.

Here is my python code, essentially just copied from the link:

```
import treelite
import tl2cgen

builder = treelite.ModelBuilder(num_feature=3)

tree = treelite.ModelBuilder.Tree()
tree[0].set_numerical_test_node(
feature_id=0,
opname="<",
threshold=5.0,
default_left=True,
left_child_key=1,
right_child_key=2
)
tree[1].set_leaf_node(0.6)
tree[2].set_leaf_node(-0.4)
tree[0].set_root()

builder.append(tree)
model = builder.commit() # Obtain treelite.Model object

tl2cgen.export_srcpkg(model, toolchain='gcc', pkgpath='./mymodel_pkg.zip', libname = "./mymodel.so", params={})
```

Here is the bt from the gdb:

```
#0 0x00007fffe76baf86 in void rapidjson::GenericReader, rapidjson::UTF8, rapidjson::CrtAllocator>::ParseString<0u, rapidjson::GenericStringStream >, rapidjson::GenericDocument, rapidjson::MemoryPoolAllocator, rapidjson::CrtAllocator> >(rapidjson::GenericStringStream >&, rapidjson::GenericDocument, rapidjson::MemoryPoolAllocator, rapidjson::CrtAllocator>&, bool) ()
from /home/python/py3.10/lib/libtreelite.so
#1 0x00007fffe76bc160 in void rapidjson::GenericReader, rapidjson::UTF8, rapidjson::CrtAllocator>::ParseValue<0u, rapidjson::GenericStringStream >, rapidjson::GenericDocument, rapidjson::MemoryPoolAllocator, rapidjson::CrtAllocator> >(rapidjson::GenericStringStream >&, rapidjson::GenericDocument, rapidjson::MemoryPoolAllocator, rapidjson::CrtAllocator>&) ()
from /home/python/py3.10/lib/libtreelite.so
#2 0x00007fffe5de2b68 in tl2cgen::compiler::CompilerParam::ParseFromJSON(char const*) () from /home/python/py3.10/lib/libtl2cgen.so
#3 0x00007fffe5ddde52 in TL2cgenGenerateCode () from /home/python/py3.10/lib/libtl2cgen.so
#4 0x00007ffff7e3d052 in ffi_call_unix64 () from /home/python/py3.10/lib/python3.10/lib-dynload/../../libffi.so.8
```

Wonder if anyone might have insight about what happened. Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.