Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion runtime/tests/tools/ggma_run/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@

It takes GGMA package as input. It uses **GGMA API** internally.

## Options

- `-p, --prompt`: Specify the input prompt text (default: "Lily picked up a flower.")

## Usage

```
$ ./ggma_run path_to_ggma_package
$ ./ggma_run path_to_ggma_package -p "Your custom prompt here"
$ ./ggma_run path_to_ggma_package --prompt "What is the weather today?"
```

It will run a GGML package to generate the output using the default prompt.
It will run a GGMA package to generate the output.

## Example

Expand Down
9 changes: 9 additions & 0 deletions runtime/tests/tools/ggma_run/src/args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ Args::Args(const int argc, char **argv)
void Args::initialize(void)
{
_arser.add_argument("path").type(arser::DataType::STR).help("nnpackage path");
_arser.add_argument("-p", "--prompt")
.type(arser::DataType::STR)
.default_value("Lily picked up a flower.")
.help("input prompt text");
arser::Helper::add_version(_arser, print_version);
}

Expand Down Expand Up @@ -80,6 +84,11 @@ void Args::parse(const int argc, char **argv)
exit(1);
}
}

if (_arser["--prompt"])
{
_prompt = _arser.get<std::string>("--prompt");
}
}
catch (const std::bad_cast &e)
{
Expand Down
2 changes: 2 additions & 0 deletions runtime/tests/tools/ggma_run/src/args.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Args
void print(void);

const std::string &packagePath() const { return _package_path; }
const std::string &prompt() const { return _prompt; }
bool printVersion() const { return _print_version; }

private:
Expand All @@ -43,6 +44,7 @@ class Args
arser::Arser _arser;

std::string _package_path;
std::string _prompt;
bool _print_version = false;
};

Expand Down
2 changes: 1 addition & 1 deletion runtime/tests/tools/ggma_run/src/ggma_run.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int main(const int argc, char **argv)
{
Args args(argc, argv);

std::string prompt = "Lily picked up a flower.";
std::string prompt = args.prompt();
constexpr size_t n_tokens_max = 32;
ggma_token tokens[n_tokens_max];
size_t n_tokens;
Expand Down