// Automatically generated by Interoptopus. #ifndef edge_transformers #define edge_transformers #ifdef __cplusplus extern "C" { #endif #include #include typedef enum deviceffi { DEVICEFFI_CPU = 0, DEVICEFFI_DML = 1, } deviceffi; typedef enum graphoptimizationlevelffi { GRAPHOPTIMIZATIONLEVELFFI_DISABLE = 0, GRAPHOPTIMIZATIONLEVELFFI_LEVEL1 = 1, GRAPHOPTIMIZATIONLEVELFFI_LEVEL2 = 2, GRAPHOPTIMIZATIONLEVELFFI_LEVEL3 = 99, } graphoptimizationlevelffi; typedef enum poolingstrategyffi { POOLINGSTRATEGYFFI_MEAN = 0, POOLINGSTRATEGYFFI_MAX = 1, POOLINGSTRATEGYFFI_FIRST = 2, } poolingstrategyffi; typedef struct conditionalgenerationpipelineffi conditionalgenerationpipelineffi; typedef struct conditionalgenerationpipelinewithpkvsffi conditionalgenerationpipelinewithpkvsffi; typedef struct embeddingpipelineffi embeddingpipelineffi; /// Holds text embedding with model specific threshold for cosine similarity. typedef struct envcontainer envcontainer; typedef struct optimumseq2seqpipelineffi optimumseq2seqpipelineffi; typedef struct optimumseq2seqpipelinewithpkvsffi optimumseq2seqpipelinewithpkvsffi; typedef struct seq2seqgenerationpipelineffi seq2seqgenerationpipelineffi; typedef struct sequenceclassificationpipelineffi sequenceclassificationpipelineffi; typedef struct stringbatch stringbatch; typedef struct tokenclassificationpipelineffi tokenclassificationpipelineffi; typedef enum ffierror { FFIERROR_OK = 0, FFIERROR_NULL = 100, FFIERROR_PANIC = 200, FFIERROR_FAIL = 300, } ffierror; typedef struct classpredictionffi { const char* label; float score; } classpredictionffi; typedef struct useasciistringpattern { const char* ascii_string; } useasciistringpattern; ///Option type containing boolean flag and maybe valid data. typedef struct optionstringbatch { stringbatch t; uint8_t is_some; } optionstringbatch; ///A pointer to an array of data someone else owns which may not be modified. typedef struct slicef32 { const float* data; uint64_t len; } slicef32; typedef struct embeddingffi { slicef32 embedding; } embeddingffi; ///A pointer to an array of data someone else owns which may not be modified. typedef struct sliceclasspredictionffi { const classpredictionffi* data; uint64_t len; } sliceclasspredictionffi; ///A pointer to an array of data someone else owns which may not be modified. typedef struct sliceuseasciistringpattern { const useasciistringpattern* data; uint64_t len; } sliceuseasciistringpattern; typedef struct predictionffi { classpredictionffi best; sliceclasspredictionffi all; } predictionffi; typedef struct tokenclasspredictionffi { classpredictionffi best; sliceclasspredictionffi all; uint32_t start; uint32_t end; } tokenclasspredictionffi; ///A pointer to an array of data someone else owns which may not be modified. typedef struct sliceembeddingffi { const embeddingffi* data; uint64_t len; } sliceembeddingffi; ///A pointer to an array of data someone else owns which may not be modified. typedef struct slicepredictionffi { const predictionffi* data; uint64_t len; } slicepredictionffi; ///A pointer to an array of data someone else owns which may not be modified. typedef struct slicetokenclasspredictionffi { const tokenclasspredictionffi* data; uint64_t len; } slicetokenclasspredictionffi; typedef struct taggedstringffi { const char* input_string; slicetokenclasspredictionffi tags; } taggedstringffi; ///A pointer to an array of data someone else owns which may not be modified. typedef struct slicetaggedstringffi { const taggedstringffi* data; uint64_t len; } slicetaggedstringffi; /// Destroys the given instance. /// /// # Safety /// /// The passed parameter MUST have been created with the corresponding init function; /// passing any other value results in undefined behavior. ffierror onnx_env_destroy(envcontainer** context); ffierror onnx_env_new(envcontainer** context); /// Destroys the given instance. /// /// # Safety /// /// The passed parameter MUST have been created with the corresponding init function; /// passing any other value results in undefined behavior. ffierror onnx_string_batch_destroy(stringbatch** context); ffierror onnx_string_batch_new(stringbatch** context); ffierror onnx_string_batch_add(stringbatch* context, const char* add_string); const char* onnx_string_batch_get(const stringbatch* context, uint32_t id); uint32_t onnx_string_batch_length(const stringbatch* context); ffierror onnx_string_batch_clear(stringbatch* context); /// Destroys the given instance. /// /// # Safety /// /// The passed parameter MUST have been created with the corresponding init function; /// passing any other value results in undefined behavior. ffierror onnx_cond_gen_destroy(conditionalgenerationpipelineffi** context); ffierror onnx_cond_gen_from_pretrained(conditionalgenerationpipelineffi** context, const envcontainer* env, const char* model_id, deviceffi device, graphoptimizationlevelffi optimization); ffierror onnx_cond_gen_create_from_files(conditionalgenerationpipelineffi** context, const envcontainer* env, const char* model_path, const char* tokenizer_config_path, const char* special_tokens_map_path, deviceffi device, graphoptimizationlevelffi optimization); const char* onnx_cond_gen_generate_topk_sampling(conditionalgenerationpipelineffi* context, const char* input, int32_t max_length, int32_t topk, float temperature); const char* onnx_cond_gen_generate_random_sampling(conditionalgenerationpipelineffi* context, const char* input, int32_t max_length, float temperature); const char* onnx_cond_gen_generate_argmax(conditionalgenerationpipelineffi* context, const char* input, int32_t max_length); sliceuseasciistringpattern onnx_cond_gen_generate_topk_sampling_batch(conditionalgenerationpipelineffi* s, stringbatch input, int32_t max_length, int32_t topk, float temperature); sliceuseasciistringpattern onnx_cond_gen_generate_random_sampling_batch(conditionalgenerationpipelineffi* s, stringbatch input, int32_t max_length, float temperature); sliceuseasciistringpattern onnx_cond_gen_generate_argmax_batch(conditionalgenerationpipelineffi* s, stringbatch input, int32_t max_length); /// Destroys the given instance. /// /// # Safety /// /// The passed parameter MUST have been created with the corresponding init function; /// passing any other value results in undefined behavior. ffierror onnx_cond_gen_pkvs_destroy(conditionalgenerationpipelinewithpkvsffi** context); ffierror onnx_cond_gen_pkvs_from_pretrained(conditionalgenerationpipelinewithpkvsffi** context, const envcontainer* env, const char* model_id, deviceffi device, graphoptimizationlevelffi optimization); ffierror onnx_cond_gen_pkvs_create_from_paths(conditionalgenerationpipelinewithpkvsffi** context, const envcontainer* env, const char* model, const char* tokenizer_config, const char* special_tokens_map, deviceffi device, graphoptimizationlevelffi optimization); const char* onnx_cond_gen_pkvs_generate_topk_sampling(conditionalgenerationpipelinewithpkvsffi* context, const char* input, int32_t max_length, int32_t topk, float temperature); const char* onnx_cond_gen_pkvs_generate_random_sampling(conditionalgenerationpipelinewithpkvsffi* context, const char* input, int32_t max_length, float temperature); const char* onnx_cond_gen_pkvs_generate_argmax(conditionalgenerationpipelinewithpkvsffi* context, const char* input, int32_t max_length); sliceuseasciistringpattern onnx_cond_gen_pkvs_generate_topk_sampling_batch(conditionalgenerationpipelinewithpkvsffi* s, stringbatch input, int32_t max_length, int32_t topk, float temperature); sliceuseasciistringpattern onnx_cond_gen_pkvs_generate_random_sampling_batch(conditionalgenerationpipelinewithpkvsffi* s, stringbatch input, int32_t max_length, float temperature); sliceuseasciistringpattern onnx_cond_gen_pkvs_generate_argmax_batch(conditionalgenerationpipelinewithpkvsffi* s, stringbatch input, int32_t max_length); /// Destroys the given instance. /// /// # Safety /// /// The passed parameter MUST have been created with the corresponding init function; /// passing any other value results in undefined behavior. ffierror onnx_emb_destroy(embeddingpipelineffi** context); ffierror onnx_emb_from_pretrained(embeddingpipelineffi** context, const envcontainer* env, const char* model_id, poolingstrategyffi pooling_strategy, deviceffi device, graphoptimizationlevelffi optimization); ffierror onnx_emb_create_from_files(embeddingpipelineffi** context, const envcontainer* env, const char* model_path, const char* tokenizer_config_path, const char* special_tokens_map_path, poolingstrategyffi pooling_strategy, deviceffi device, graphoptimizationlevelffi optimization); embeddingffi onnx_emb_embed(embeddingpipelineffi* s, const char* input); sliceembeddingffi onnx_emb_embed_batch(embeddingpipelineffi* s, stringbatch input); /// Destroys the given instance. /// /// # Safety /// /// The passed parameter MUST have been created with the corresponding init function; /// passing any other value results in undefined behavior. ffierror onnx_token_classification_destroy(tokenclassificationpipelineffi** context); ffierror onnx_token_classification_from_pretrained(tokenclassificationpipelineffi** context, const envcontainer* env, const char* model_id, deviceffi device, graphoptimizationlevelffi optimization); ffierror onnx_token_classification_create_from_files(tokenclassificationpipelineffi** context, const envcontainer* env, const char* model_path, const char* tokenizer_config_path, const char* special_tokens_map_path, deviceffi device, graphoptimizationlevelffi optimization); taggedstringffi onnx_token_classification_tag(tokenclassificationpipelineffi* s, const char* input); slicetaggedstringffi onnx_token_classification_tag_batch(tokenclassificationpipelineffi* s, stringbatch input); /// Destroys the given instance. /// /// # Safety /// /// The passed parameter MUST have been created with the corresponding init function; /// passing any other value results in undefined behavior. ffierror onnx_classification_destroy(sequenceclassificationpipelineffi** context); ffierror onnx_classification_from_pretrained(sequenceclassificationpipelineffi** context, const envcontainer* env, const char* model_id, deviceffi device, graphoptimizationlevelffi optimization); ffierror onnx_classification_create_from_files(sequenceclassificationpipelineffi** context, const envcontainer* env, const char* model_path, const char* tokenizer_config_path, const char* special_tokens_map_path, deviceffi device, graphoptimizationlevelffi optimization); predictionffi onnx_classification_classify(sequenceclassificationpipelineffi* s, const char* input); slicepredictionffi onnx_classification_classify_batch(sequenceclassificationpipelineffi* s, stringbatch input); /// Destroys the given instance. /// /// # Safety /// /// The passed parameter MUST have been created with the corresponding init function; /// passing any other value results in undefined behavior. ffierror onnx_optimum_seq2seq_destroy(optimumseq2seqpipelineffi** context); ffierror onnx_optimum_seq2seq_from_pretrained(optimumseq2seqpipelineffi** context, const envcontainer* env, const char* model_id, deviceffi device, graphoptimizationlevelffi optimization); ffierror onnx_optimum_seq2seq_create_from_files(optimumseq2seqpipelineffi** context, const envcontainer* env, const char* encoder_model_path, const char* decoder_model_path, const char* tokenizer_config_path, const char* special_tokens_map_path, deviceffi device, graphoptimizationlevelffi optimization); const char* onnx_optimum_seq2seq_generate_topk_sampling(optimumseq2seqpipelineffi* context, const char* input, const char* decoder_input, int32_t max_length, int32_t topk, float temperature); const char* onnx_optimum_seq2seq_generate_random_sampling(optimumseq2seqpipelineffi* context, const char* input, const char* decoder_input, int32_t max_length, float temperature); const char* onnx_optimum_seq2seq_generate_argmax(optimumseq2seqpipelineffi* context, const char* input, const char* decoder_input, int32_t max_length); sliceuseasciistringpattern onnx_optimum_seq2seq_generate_topk_sampling_batch(optimumseq2seqpipelineffi* s, stringbatch input, optionstringbatch decoder_input, int32_t max_length, int32_t topk, float temperature); sliceuseasciistringpattern onnx_optimum_seq2seq_generate_random_sampling_batch(optimumseq2seqpipelineffi* s, stringbatch input, optionstringbatch decoder_input, int32_t max_length, float temperature); sliceuseasciistringpattern onnx_optimum_seq2seq_generate_argmax_batch(optimumseq2seqpipelineffi* s, stringbatch input, optionstringbatch decoder_input, int32_t max_length); /// Destroys the given instance. /// /// # Safety /// /// The passed parameter MUST have been created with the corresponding init function; /// passing any other value results in undefined behavior. ffierror onnx_optimum_seq2seq_pkvs_destroy(optimumseq2seqpipelinewithpkvsffi** context); ffierror onnx_optimum_seq2seq_pkvs_from_pretrained(optimumseq2seqpipelinewithpkvsffi** context, const envcontainer* env, const char* model_id, deviceffi device, graphoptimizationlevelffi optimization); ffierror onnx_optimum_seq2seq_pkvs_create_from_files(optimumseq2seqpipelinewithpkvsffi** context, const envcontainer* env, const char* encoder_model_path, const char* decoder_model_path, const char* decoder_model_pkvs_path, const char* tokenizer_config_path, const char* special_tokens_map_path, deviceffi device, graphoptimizationlevelffi optimization_level); const char* onnx_optimum_seq2seq_pkvs_generate_topk_sampling(optimumseq2seqpipelinewithpkvsffi* context, const char* input, const char* decoder_input, int32_t max_length, int32_t topk, float temperature); const char* onnx_optimum_seq2seq_pkvs_generate_random_sampling(optimumseq2seqpipelinewithpkvsffi* context, const char* input, const char* decoder_input, int32_t max_length, float temperature); const char* onnx_optimum_seq2seq_pkvs_generate_argmax(optimumseq2seqpipelinewithpkvsffi* context, const char* input, const char* decoder_input, int32_t max_length); sliceuseasciistringpattern onnx_optimum_seq2seq_pkvs_generate_topk_sampling_batch(optimumseq2seqpipelinewithpkvsffi* s, stringbatch input, optionstringbatch decoder_input, int32_t max_length, int32_t topk, float temperature); sliceuseasciistringpattern onnx_optimum_seq2seq_pkvs_generate_random_sampling_batch(optimumseq2seqpipelinewithpkvsffi* s, stringbatch input, optionstringbatch decoder_input, int32_t max_length, float temperature); sliceuseasciistringpattern onnx_optimum_seq2seq_pkvs_generate_argmax_batch(optimumseq2seqpipelinewithpkvsffi* s, stringbatch input, optionstringbatch decoder_input, int32_t max_length); /// Destroys the given instance. /// /// # Safety /// /// The passed parameter MUST have been created with the corresponding init function; /// passing any other value results in undefined behavior. ffierror onnx_seq2seq_destroy(seq2seqgenerationpipelineffi** context); ffierror onnx_seq2seq_from_pretrained(seq2seqgenerationpipelineffi** context, const envcontainer* env, const char* model_id, deviceffi device, graphoptimizationlevelffi optimization); ffierror onnx_seq2seq_create_from_files(seq2seqgenerationpipelineffi** context, const envcontainer* env, const char* model_path, const char* tokenizer_config_path, const char* special_tokens_map_path, deviceffi device, graphoptimizationlevelffi optimization); const char* onnx_seq2seq_generate_topk_sampling(seq2seqgenerationpipelineffi* context, const char* input, const char* decoder_input, int32_t max_length, int32_t topk, float temperature); const char* onnx_seq2seq_generate_random_sampling(seq2seqgenerationpipelineffi* context, const char* input, const char* decoder_input, int32_t max_length, float temperature); const char* onnx_seq2seq_generate_argmax(seq2seqgenerationpipelineffi* context, const char* input, const char* decoder_input, int32_t max_length); sliceuseasciistringpattern onnx_seq2seq_generate_topk_sampling_batch(seq2seqgenerationpipelineffi* s, stringbatch input, optionstringbatch decoder_input, int32_t max_length, int32_t topk, float temperature); sliceuseasciistringpattern onnx_seq2seq_generate_random_sampling_batch(seq2seqgenerationpipelineffi* s, stringbatch input, optionstringbatch decoder_input, int32_t max_length, float temperature); sliceuseasciistringpattern onnx_seq2seq_generate_argmax_batch(seq2seqgenerationpipelineffi* s, stringbatch input, optionstringbatch decoder_input, int32_t max_length); #ifdef __cplusplus } #endif #endif /* edge_transformers */