-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I'm trying to use the annotation_in parameter in tl2cgen.export_lib, but it doesn't seem to have any effect. I get the same output whether I include the parameter or not. Here’s the code I’m using:
# Generate annotations from the training data
def generate_annotations(X_train, model, output_annotation_file):
# Convert training data to DMatrix (required for annotation)
dmat = tl2cgen.DMatrix(X_train)
# Generate branch annotations based on the training data and save to file
tl2cgen.annotate_branch(model=model, dmat=dmat, path=output_annotation_file)
print(f"Branch annotations saved to: {output_annotation_file}")
# Export the TL2cgen optimized model
def export_optimized_model(treelite_model, output_model_path, annotation_file):
# Export the optimized model with quantization and branch annotations
tl2cgen.export_lib(
treelite_model,
toolchain="gcc",
libpath=output_model_path,
params={"quantize": 1, "annotate_in": annotation_file, "parallel_comp":16},
verbose=True
)
print(f"Optimized model saved to: {output_model_path}")
I got same output with annotate_in removed, is there something I'm missing? Any idea why?
The annotation file seems correctly formatted and contains feature information.Its generated from annotate_branch using the same model.
- treelite 4.3.0
- tl2cgen 1.0.0
The verbose output is:
[11:56:26] /tmp/tmpfk5q71dd/libbuild/_deps/treelite-src/src/serializer.cc:202: The model you are loading originated from a newer Treelite version; some functionalities may be unavailable.
Currently running Treelite version 4.1.2
The model checkpoint was generated from Treelite version 4.3.0
Branch annotations saved to: branch_annotations.json
[11:56:27] /tmp/tmpfk5q71dd/libbuild/_deps/treelite-src/src/serializer.cc:202: The model you are loading originated from a newer Treelite version; some functionalities may be unavailable.
Currently running Treelite version 4.1.2
The model checkpoint was generated from Treelite version 4.3.0
[11:56:27] /project/src/compiler/ast/split.cc:35: Parallel compilation enabled; member trees will be divided into 16 translation units.
Compiling sources files in directory /tmp/tmp0_wpqw_r into object files (*.o)...
Generating dynamic shared library /tmp/tmp0_wpqw_r/predictor.so...
Generated shared library in 12.63 seconds
Optimized model saved to: tl_v3.so
Any ideas on why this might be happening? Thanks in advance!
Metadata
Metadata
Assignees
Labels
No labels