YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Llama2Device_ParamsParser Class Reference

This class is the parameters parser for class Llama2Device. More...

#include </home/runner/work/yarp-documentation/yarp-documentation/yarp/opt-modules/yarp-device-llama2/src/devices/llama2Device/Llama2Device_ParamsParser.h>

+ Inheritance diagram for Llama2Device_ParamsParser:

Classes

struct  parser_version_type
 

Public Member Functions

 Llama2Device_ParamsParser ()
 
 ~Llama2Device_ParamsParser () override=default
 
bool parseParams (const yarp::os::Searchable &config) override
 Parse the DeviceDriver parameters.
 
std::string getDeviceClassName () const override
 Get the name of the DeviceDriver class.
 
std::string getDeviceName () const override
 Get the name of the device (i.e.
 
std::string getDocumentationOfDeviceParams () const override
 Get the documentation of the DeviceDriver's parameters.
 
std::vector< std::string > getListOfParams () const override
 Return a list of all params used by the device.
 
bool getParamValue (const std::string &paramName, std::string &paramValue) const override
 Return the value (represented as a string) of the requested parameter.
 
std::string getConfiguration () const override
 Return the configuration of the device.
 
- Public Member Functions inherited from yarp::dev::IDeviceDriverParams
virtual ~IDeviceDriverParams ()
 

Public Attributes

const std::string m_device_classname = {"Llama2Device"}
 
const std::string m_device_name = {"yarp_llama2Device"}
 
bool m_parser_is_strict = false
 
const parser_version_type m_parser_version = {}
 
std::string m_provided_configuration
 
const std::string m_model_context_defaultValue = {""}
 
const std::string m_model_name_defaultValue = {""}
 
const std::string m_npredict_defaultValue = {"128"}
 
const std::string m_ngl_defaultValue = {"50"}
 
const std::string m_offload_gpu_defaultValue = {"true"}
 
const std::string m_context_defaultValue = {"4096"}
 
const std::string m_prompt_file_defaultValue = {""}
 
const std::string m_prompt_context_defaultValue = {""}
 
std::string m_model_context = {}
 
std::string m_model_name = {}
 
int m_npredict = {128}
 
int m_ngl = {50}
 
bool m_offload_gpu = {true}
 
int m_context = {4096}
 
std::string m_prompt_file = {}
 
std::string m_prompt_context = {}
 

Detailed Description

This class is the parameters parser for class Llama2Device.

These are the used parameters:

Group name Parameter name Type Units Default Value Required Description Notes
- model_context string - - 0 context of Llama2 model Here are additional notes
- model_name string - - 1 name of Llama2 model Here are additional notes
- npredict int - 128 0 number of tokens generated by the model Here are additional notes
- ngl int - 50 0 number of layers to offload to the gpu Here are additional notes
- offload_gpu bool - true 0 bool value to offload computations to gpu (default = true) Here are additional notes
- context int - 4096 0 context size (use ctx_size = 0 to load context size from the model) Here are additional notes
- prompt_file string - - 0 The file containing the prompt for the LLM -
- prompt_context string - - 0 The yarp context from which the prompt file should be loaded -

The device can be launched by yarpdev using one of the following examples (with and without all optional parameters):

yarpdev --device yarp_llama2Device --model_context <optional_value> --model_name <mandatory_value> --npredict 128 --ngl 50 --offload_gpu true --context 4096 --prompt_file <optional_value> --prompt_context <optional_value>
yarpdev --device yarp_llama2Device --model_name <mandatory_value>

Definition at line 48 of file Llama2Device_ParamsParser.h.

Constructor & Destructor Documentation

◆ Llama2Device_ParamsParser()

Llama2Device_ParamsParser::Llama2Device_ParamsParser ( )

Definition at line 23 of file Llama2Device_ParamsParser.cpp.

◆ ~Llama2Device_ParamsParser()

Llama2Device_ParamsParser::~Llama2Device_ParamsParser ( )
overridedefault

Member Function Documentation

◆ getConfiguration()

std::string Llama2Device_ParamsParser::getConfiguration ( ) const
overridevirtual

Return the configuration of the device.

Returns
The configuration of the device, represented in a string format.

Implements yarp::dev::IDeviceDriverParams.

Definition at line 93 of file Llama2Device_ParamsParser.cpp.

◆ getDeviceClassName()

std::string Llama2Device_ParamsParser::getDeviceClassName ( ) const
inlineoverridevirtual

Get the name of the DeviceDriver class.

Returns
A string containing the name of the class.

Implements yarp::dev::IDeviceDriverParams.

Definition at line 86 of file Llama2Device_ParamsParser.h.

◆ getDeviceName()

std::string Llama2Device_ParamsParser::getDeviceName ( ) const
inlineoverridevirtual

Get the name of the device (i.e.

the plugin name).

Returns
A string containing the name of the device.

Implements yarp::dev::IDeviceDriverParams.

Definition at line 87 of file Llama2Device_ParamsParser.h.

◆ getDocumentationOfDeviceParams()

std::string Llama2Device_ParamsParser::getDocumentationOfDeviceParams ( ) const
overridevirtual

Get the documentation of the DeviceDriver's parameters.

Returns
A string containing the documentation.

Implements yarp::dev::IDeviceDriverParams.

Definition at line 256 of file Llama2Device_ParamsParser.cpp.

◆ getListOfParams()

std::vector< std::string > Llama2Device_ParamsParser::getListOfParams ( ) const
overridevirtual

Return a list of all params used by the device.

Returns
A vector containing the names of parameters used by the device.

Implements yarp::dev::IDeviceDriverParams.

Definition at line 28 of file Llama2Device_ParamsParser.cpp.

◆ getParamValue()

bool Llama2Device_ParamsParser::getParamValue ( const std::string &  paramName,
std::string &  paramValue 
) const
overridevirtual

Return the value (represented as a string) of the requested parameter.

Returns
True if the requested parameter was succesfully retrieved.

Implements yarp::dev::IDeviceDriverParams.

Definition at line 43 of file Llama2Device_ParamsParser.cpp.

◆ parseParams()

bool Llama2Device_ParamsParser::parseParams ( const yarp::os::Searchable &  config)
overridevirtual

Parse the DeviceDriver parameters.

Returns
true if the parsing is successful, false otherwise

Implements yarp::dev::IDeviceDriverParams.

Definition at line 103 of file Llama2Device_ParamsParser.cpp.

Member Data Documentation

◆ m_context

int Llama2Device_ParamsParser::m_context = {4096}

Definition at line 81 of file Llama2Device_ParamsParser.h.

◆ m_context_defaultValue

const std::string Llama2Device_ParamsParser::m_context_defaultValue = {"4096"}

Definition at line 72 of file Llama2Device_ParamsParser.h.

◆ m_device_classname

const std::string Llama2Device_ParamsParser::m_device_classname = {"Llama2Device"}

Definition at line 55 of file Llama2Device_ParamsParser.h.

◆ m_device_name

const std::string Llama2Device_ParamsParser::m_device_name = {"yarp_llama2Device"}

Definition at line 56 of file Llama2Device_ParamsParser.h.

◆ m_model_context

std::string Llama2Device_ParamsParser::m_model_context = {}

Definition at line 76 of file Llama2Device_ParamsParser.h.

◆ m_model_context_defaultValue

const std::string Llama2Device_ParamsParser::m_model_context_defaultValue = {""}

Definition at line 67 of file Llama2Device_ParamsParser.h.

◆ m_model_name

std::string Llama2Device_ParamsParser::m_model_name = {}

Definition at line 77 of file Llama2Device_ParamsParser.h.

◆ m_model_name_defaultValue

const std::string Llama2Device_ParamsParser::m_model_name_defaultValue = {""}

Definition at line 68 of file Llama2Device_ParamsParser.h.

◆ m_ngl

int Llama2Device_ParamsParser::m_ngl = {50}

Definition at line 79 of file Llama2Device_ParamsParser.h.

◆ m_ngl_defaultValue

const std::string Llama2Device_ParamsParser::m_ngl_defaultValue = {"50"}

Definition at line 70 of file Llama2Device_ParamsParser.h.

◆ m_npredict

int Llama2Device_ParamsParser::m_npredict = {128}

Definition at line 78 of file Llama2Device_ParamsParser.h.

◆ m_npredict_defaultValue

const std::string Llama2Device_ParamsParser::m_npredict_defaultValue = {"128"}

Definition at line 69 of file Llama2Device_ParamsParser.h.

◆ m_offload_gpu

bool Llama2Device_ParamsParser::m_offload_gpu = {true}

Definition at line 80 of file Llama2Device_ParamsParser.h.

◆ m_offload_gpu_defaultValue

const std::string Llama2Device_ParamsParser::m_offload_gpu_defaultValue = {"true"}

Definition at line 71 of file Llama2Device_ParamsParser.h.

◆ m_parser_is_strict

bool Llama2Device_ParamsParser::m_parser_is_strict = false

Definition at line 57 of file Llama2Device_ParamsParser.h.

◆ m_parser_version

const parser_version_type Llama2Device_ParamsParser::m_parser_version = {}

Definition at line 63 of file Llama2Device_ParamsParser.h.

◆ m_prompt_context

std::string Llama2Device_ParamsParser::m_prompt_context = {}

Definition at line 83 of file Llama2Device_ParamsParser.h.

◆ m_prompt_context_defaultValue

const std::string Llama2Device_ParamsParser::m_prompt_context_defaultValue = {""}

Definition at line 74 of file Llama2Device_ParamsParser.h.

◆ m_prompt_file

std::string Llama2Device_ParamsParser::m_prompt_file = {}

Definition at line 82 of file Llama2Device_ParamsParser.h.

◆ m_prompt_file_defaultValue

const std::string Llama2Device_ParamsParser::m_prompt_file_defaultValue = {""}

Definition at line 73 of file Llama2Device_ParamsParser.h.

◆ m_provided_configuration

std::string Llama2Device_ParamsParser::m_provided_configuration

Definition at line 65 of file Llama2Device_ParamsParser.h.


The documentation for this class was generated from the following files: