genie-app¶
The genie-app tool is a robust test application that allows for general usage of the Genie library.
This tool exposes API-level commands and related utilities to enable a wide range of various configurations that more
closely emulates developers’ Genie SDK use cases.
DESCRIPTION:
------------
Tool for text to text inference of LLMs using Genie.
REQUIRED ARGUMENTS:
-------------------
-s or --script <FILE> Script file that contains chronological sequence of script commands
OPTIONAL ARGUMENTS:
-------------------
-h or --help Show this help message and exit. Help message contains all currently supported script commands
SCRIPT COMMANDS:
----------------
dialog config create CONFIG_NAME FILE.json
dialog config bind profile CONFIG_NAME PROFILE_NAME
dialog config bind log CONFIG_NAME LOG_NAME
dialog config free CONFIG_NAME
dialog create DIALOG_NAME CONFIG_NAME
dialog query DIALOG_NAME ["PROMPT_STR"/PROMPT_FILE] [OUTPUT_FILE]
dialog rewindQuery DIALOG_NAME ["PROMPT_STR"/PROMPT_FILE] [OUTPUT_FILE]
dialog embeddingQuery DIALOG_NAME EMBEDDINGS_PATH EMBEDDINGS_TABLE_PATH
dialog embeddingTokenQuery DIALOG_NAME EMBEDDINGS_PATH EMBEDDINGS_TABLE_PATH
dialog tokenQuery DIALOG_NAME TOKENS_PATH
dialog applyLora DIALOG_NAME ENGINE_NAME ADAPTER_NAME
dialog setLoraStrength DIALOG_NAME ENGINE_NAME TENSOR_NAME_1 ALPHA_1 ...
dialog reset DIALOG_NAME
dialog save DIALOG_NAME PATH
dialog restore DIALOG_NAME PATH
dialog setPerformance DIALOG_NAME PERFORMANCE_MODE
dialog free DIALOG_NAME
dialog getValue DIALOG_NAME GENIE_DIALOG_PARAM
dialog getTokenizer DIALOG_NAME TOKENIZER_NAME
dialog setMaxNumTokens DIALOG_NAME MAX_NUM_TOKENS
dialog setStopSequence DIALOG_NAME ["STOP_SEQUENCE_JSON_STR"/STOP_SEQUENCE_JSON_FILE]
embedding config create CONFIG_NAME FILE.json
embedding config bind profile CONFIG_NAME PROFILE_NAME
embedding config bind log CONFIG_NAME LOG_NAME
embedding config free CONFIG_NAME
embedding create EMBEDDING_NAME CONFIG_NAME
embedding generate EMBEDDING_NAME ["PROMPT_STR"/PROMPT_FILE] [OUTPUT_FILE]
embedding setPerformance EMBEDDING_NAME PERFORMANCE_MODE
embedding free EMBEDDING_NAME
log create LOG_NAME LEVEL [OUTPUT_FILE.txt]
log free LOG_NAME
node config create CONFIG_NAME FILE.json
node config free CONFIG_NAME
node config bind profile CONFIG_NAME PROFILE_NAME
node config bind log CONFIG_NAME LOG_NAME
node create NODE_NAME CONFIG_NAME
node set text NODE_NAME NODE_IO TEXT_PROMPT
node set textFile NODE_NAME NODE_IO TEXT_PROMPT_FILE_PATH
node set image NODE_NAME NODE_IO IMAGE_PATH
node set embedding NODE_NAME NODE_IO EMBEDDING_PATH
node set textCallback NODE_NAME NODE_IO
node set embeddingCallback NODE_NAME
node applyLora NODE_NAME ENGINE_NAME ADAPTER_NAME
node setLoraStrength NODE_NAME ENGINE_NAME TENSOR_NAME_1 ALPHA_1 ...
node free NODE_NAME
pipeline config create CONFIG_NAME FILE.json
pipeline config bind profile CONFIG_NAME PROFILE_NAME
pipeline config bind log CONFIG_NAME LOG_NAME
pipeline config free CONFIG_NAME
pipeline create PIPELINE_NAME CONFIG_NAME
pipeline add PIPELINE_NAME NODE_NAME
pipeline connect PIPELINE_NAME PRODUCER_NODE_NAME PRODUCER_NODE_IO CONSUMER_NODE_NAME CONSUMER_NODE_IO
pipeline execute PIPELINE_NAME [OUTPUT_FILE]
pipeline reset PIPELINE_NAME
pipeline save PIPELINE_NAME PATH
pipeline restore PIPELINE_NAME PATH
pipeline free PIPELINE_NAME
profile config create CONFIG_NAME FILE.json
profile config free CONFIG_NAME
profile create PROFILE_NAME [CONFIG_NAME]
profile save PROFILE_NAME [OUTPUT_FILE.json]
profile free PROFILE_NAME
tokenizer encode TOKENIZER_NAME INPUT_STRING
tokenizer decode TOKENIZER_NAME TOKEN_SIZE TOKEN_ID_1 ...
accuracy config create CONFIG_NAME FILE.json
accuracy config free CONFIG_NAME
accuracy create ACCURACY_NAME CONFIG_NAME [dialog/node] DIALOG_NAME
accuracy compute ACCURACY_NAME OUTPUT_FILE.json
accuracy free ACCURACY_NAME
version
help
script FILE
loop [NUMBER OF ITERATIONS]
endloop
sleep [DURATION in ms]
history [save FILE]
ls
exit
See Tutorials for a reference example on how to use the genie-app tool.
Script Statement to C API Mapping¶
In genie-app scripts, names are used to represent Genie C API handles. Generally, DIALOG_NAME translates to a GenieDialog_Handle_t, PIPELINE_NAME to a GeniePipeline_Handle_t, and so on. If there is a CONFIG_NAME argument, it would correspond to a configuration handle to the respective API component. For example, the “dialog create” CONFIG_NAME would refer to a GenieDialogConfig_Handle_t.
The following genie-app script statements do not have a corresponding Genie C API function:
help
ls
history
script
loop/endloop
sleep
exit
The following Genie C APIs are not yet supported in genie-app:
GenieDialog_tokenQuery
GenieDialog_getSampler
GenieDialog_signal
GenieDialog_setPriority
GenieDialog_setOemKey
GenieDialog_bindEngine
GenieDialog_getEngine
GenieDialog_getPerformancePolicy
GenieEmbedding_getPerformancePolicy
GenieNode_bindEngine
GenieNode_getEngine
GenieNode_getSampler
GenieNode_getTokenizer
GeniePipeline_setPriority
GeniePipeline_setOemKey
GenieSamplerConfig_createFromJson
GenieSamplerConfig_setParam
GenieSamplerConfig_free
GenieSampler_applyConfig
GenieSampler_registerCallback
GenieSampler_registerUserDataCallback
GenieEngineConfig_createFromJson
GenieEngineConfig_bindProfiler
GenieEngineConfig_bindLogger
GenieEngineConfig_free
GenieEngine_create
GenieEngine_free
Statement |
Genie C API |
|---|---|
dialog config create |
|
dialog config bind profile |
|
dialog config bind log |
|
dialog config free |
|
dialog create |
|
dialog query |
|
dialog rewindQuery |
|
dialog embeddingQuery |
|
dialog embeddingTokenQuery |
|
dialog tokenQuery |
|
dialog applyLora |
|
dialog setLoraStrength |
|
dialog reset |
|
dialog save |
|
dialog restore |
|
dialog setPerformance |
|
dialog free |
|
dialog getTokenizer |
|
dialog getValue |
|
dialog setMaxNumTokens |
|
dialog setStopSequence |
|
embedding config create |
|
embedding config bind profile |
|
embedding config bind log |
|
embedding config free |
|
embedding create |
|
embedding generate |
|
embedding setPerformance |
|
embedding free |
|
log create |
|
log free |
|
node config create |
|
node config bind profile |
|
node config bind log |
|
node config free |
|
node create |
|
node set text |
|
node set textFile |
|
node set image |
|
node set embedding |
|
node set textCallback |
|
node set embeddingCallback |
|
node applyLora |
|
node setLoraStrength |
|
node free |
|
pipeline config create |
|
pipeline config bind profile |
|
pipeline config bind log |
|
pipeline config free |
|
pipeline create |
|
pipeline add |
|
pipeline connect |
|
pipeline execute |
|
pipeline reset |
|
pipeline save |
|
pipeline restore |
|
pipeline free |
|
profile config create |
|
profile config free |
|
profile create |
|
profile save |
|
profile free |
|
tokenizer encode |
|
tokenizer decode |
|
accuracy config create |
|
accuracy config free |
|
accuracy create |
|
accuracy compute |
|
accuracy free |
|
version |