|
TinyLlama.cpp 1.0
A lightweight C++ implementation of the TinyLlama language model
|
Static logging class for application-wide logging. More...
#include <logger.h>

Public Types | |
| enum class | Level : int { DEBUG = 0 , INFO = 1 , WARNING = 2 , ERROR = 3 , CRITICAL = 4 , OFF = 5 } |
Static Public Member Functions | |
| static void | set_level (Level new_level) |
| static Level | get_level () |
| static void | set_logfile (const std::string &filename) |
| static void | enable_console (bool enabled) |
| static void | debug (const std::string &message) |
| static void | info (const std::string &message) |
| static void | warning (const std::string &message) |
| static void | error (const std::string &message) |
| static void | critical (const std::string &message) |
| static void | fatal (const std::string &message) |
| static std::string | ptrToString (const void *ptr) |
| static std::string | uint16ToHex (uint16_t val) |
| template<typename T > | |
| static std::string | to_hex (T val) |
| static void | log_vector_stats (const std::string &name, const std::vector< float > &v, int n_show=5) |
| static void | log_vector_stats_int8 (const std::string &name, const std::vector< int8_t > &v, int n_show=5) |
Static Private Member Functions | |
| static void | log_internal (Level level, const std::string &message) |
| static std::string | level_to_string (Level level) |
| static void | ensure_logfile_open_and_truncated () |
Static Private Attributes | |
| static Level | current_level_ = Logger::Level::INFO |
| static std::ofstream | log_file_stream_ |
| static std::string | log_file_path_ = "debugging.log" |
| static bool | console_enabled_ = false |
| static bool | log_file_truncated_ = false |
Static logging class for application-wide logging.
Provides methods for logging messages at different severity levels (info, error, warning, debug, fatal) and utilities for logging vector statistics. All methods are static and can be called from anywhere in the application.
|
strong |
|
static |
Definition at line 147 of file logger.cpp.
References CRITICAL, and log_internal().
|
static |
Definition at line 131 of file logger.cpp.
References DEBUG, and log_internal().
Referenced by Tokenizer::add_bigram_to_queue_refactored(), Tokenizer::apply_chat_template(), argmax(), Tokenizer::bpe_tokenize(), Tokenizer::bpe_tokenize_from_scores(), Tokenizer::bpe_tokenize_to_ids(), Tokenizer::decode(), Tokenizer::decode_sentencepiece(), dequantize_q8_k(), Tokenizer::encode(), tinyllama::TinyLlamaSession::generate(), generate_bpe_merges_from_vocab_scores(), SafeTensorsLoader::load_all_tensors_parallel(), SafeTensorsLoader::load_from_directory(), SafeTensorsLoader::load_single_file(), Tokenizer::load_vocab_from_json(), SafeTensorsLoader::parse_shard_metadata(), quantize_fp32_to_q8_K(), Shard::Shard(), Tokenizer::Tokenizer(), Tokenizer::Tokenizer(), Tokenizer::tokens_to_ids(), vec_dot_q4_k_q8_k_cpu(), vec_dot_q6_k_q8_k_cpu(), and Shard::~Shard().
|
static |
Definition at line 54 of file logger.cpp.
References console_enabled_, and logger_mutex.
|
staticprivate |
Definition at line 71 of file logger.cpp.
References log_file_path_, log_file_stream_, and log_file_truncated_.
Referenced by log_internal(), and set_logfile().
|
static |
Definition at line 143 of file logger.cpp.
References ERROR, and log_internal().
Referenced by Tokenizer::add_bigram_to_queue_refactored(), apply_rope_batch_cpu(), apply_rope_vector(), tinyllama::argmax(), argmax(), attention_batch_cpu(), attention_batch_cpu_sequence_aware(), tinyllama::TinyLlamaSession::batch_generation_parallel(), tinyllama::TinyLlamaSession::batch_prefill_parallel(), Tokenizer::bpe_tokenize_to_ids(), dequantize_vector_q4k_to_f32(), dequantize_vector_q6k_to_f32(), dequantize_vector_q8_0_to_f32(), Tokenizer::encode(), TinyLlamaModel::forward(), CPUBatchProcessor::forward_cpu_batch(), TinyLlamaModel::forward_cpu_batch_generation(), TinyLlamaModel::forward_cpu_logits_batch(), tinyllama::TinyLlamaSession::generate(), tinyllama::TinyLlamaSession::generate_batch(), KVCache::initialize(), TinyLlamaModel::initialize_gpu_and_rope(), TinyLlamaModel::initialize_rope_freqs(), TinyLlamaModel::initialize_weights(), SafeTensorsLoader::load_all_tensors_parallel(), load_gguf_meta(), SafeTensorsLoader::load_model_config_from_json(), TinyLlamaModel::lookup_embedding(), main(), matmul_f32_f32_batch_cpu(), matmul_q4k_f32_batch_cpu(), matmul_q6k_f32_batch_cpu(), matmul_q8_0_f32_batch_cpu(), matvec_bf16_f32_vector_cpu(), matvec_f32_f32_vector_cpu(), rmsnorm_batch_cpu(), rmsnorm_vector_cpu(), TinyLlamaModel::TinyLlamaModel(), Tokenizer::Tokenizer(), Tokenizer::Tokenizer(), update_kv_cache_batch_cpu(), update_kv_cache_batch_cpu_sequence_aware(), weighted_sum_probs_v(), write_vector_to_file(), Shard::~Shard(), and TinyLlamaModel::~TinyLlamaModel().
|
static |
Definition at line 151 of file logger.cpp.
References CRITICAL, log_file_stream_, and log_internal().
Referenced by TinyLlamaModel::initialize_weights().
|
static |
Definition at line 39 of file logger.cpp.
References current_level_, and logger_mutex.
|
static |
Definition at line 135 of file logger.cpp.
References INFO, and log_internal().
Referenced by Tokenizer::apply_chat_template(), attention_batch_cpu(), tinyllama::TinyLlamaSession::batch_generation_parallel(), tinyllama::TinyLlamaSession::batch_prefill_parallel(), TinyLlamaModel::clear_layer_dequantized_weights(), TinyLlamaModel::ensure_bf16_concatenated_weights_loaded(), TinyLlamaModel::ensure_f32_concatenated_weights_loaded(), TinyLlamaModel::ensure_q_proj_dequantized(), TinyLlamaModel::forward(), TinyLlamaModel::forward_cpu_batch_generation(), TinyLlamaModel::forward_cpu_logits_batch(), TinyLlamaModel::free_bf16_concatenated_weights(), tinyllama::TinyLlamaSession::generate(), tinyllama::TinyLlamaSession::generate_batch(), generate_bpe_merges_from_vocab_scores(), KVCache::initialize(), TinyLlamaModel::initialize_gpu_and_rope(), TinyLlamaModel::initialize_rope_freqs(), TinyLlamaModel::initialize_weights(), SafeTensorsLoader::load_all_tensors_parallel(), Tokenizer::load_bpe_merges_from_json(), SafeTensorsLoader::load_from_directory(), load_gguf_meta(), SafeTensorsLoader::load_model_config_from_json(), SafeTensorsLoader::load_single_file(), Tokenizer::load_vocab_from_json(), log_raw_float_pointer(), log_vec_stats(), log_vector_summary(), tinyllama::log_vector_summary_detailed(), log_vector_summary_detailed(), log_vector_summary_with_tail(), TinyLlamaModel::lookup_embedding(), main(), matvec_q8k_f32_vector_cpu(), parse_model_config(), parse_model_config_from_gguf(), SafeTensorsLoader::SafeTensorsLoader(), Shard::Shard(), TinyLlamaModel::smart_gemm_batch_cuda(), TinyLlamaModel::TinyLlamaModel(), TinyLlamaModel::TinyLlamaModel(), TinyLlamaModel::TinyLlamaModel(), tinyllama::TinyLlamaSession::TinyLlamaSession(), Tokenizer::Tokenizer(), Tokenizer::Tokenizer(), update_kv_cache_batch_cpu(), write_vector_to_file(), SafeTensorsLoader::~SafeTensorsLoader(), TinyLlamaModel::~TinyLlamaModel(), and tinyllama::TinyLlamaSession::~TinyLlamaSession().
|
staticprivate |
Definition at line 59 of file logger.cpp.
References CRITICAL, DEBUG, ERROR, INFO, OFF, and WARNING.
Referenced by log_internal().
|
staticprivate |
Definition at line 101 of file logger.cpp.
References console_enabled_, CRITICAL, current_level_, ensure_logfile_open_and_truncated(), ERROR, level_to_string(), log_file_stream_, logger_mutex, OFF, and WARNING.
Referenced by critical(), debug(), error(), fatal(), info(), log_vector_stats(), log_vector_stats_int8(), and warning().
|
static |
Definition at line 160 of file logger.cpp.
References INFO, and log_internal().
|
static |
Definition at line 195 of file logger.cpp.
References INFO, and log_internal().
|
static |
Definition at line 225 of file logger.cpp.
Referenced by TinyLlamaModel::initialize_gpu_and_rope().
|
static |
Definition at line 34 of file logger.cpp.
References current_level_, and logger_mutex.
|
static |
Definition at line 44 of file logger.cpp.
References ensure_logfile_open_and_truncated(), log_file_path_, log_file_stream_, log_file_truncated_, and logger_mutex.
|
static |
Definition at line 233 of file logger.cpp.
Referenced by uint16ToHex().
|
static |
|
static |
Definition at line 139 of file logger.cpp.
References log_internal(), and WARNING.
Referenced by Tokenizer::apply_chat_template(), apply_rope_batch_cpu(), apply_rope_vector(), attention_batch_cpu(), tinyllama::TinyLlamaSession::batch_generation_parallel(), Tokenizer::bpe_tokenize(), Tokenizer::bpe_tokenize_from_scores(), Tokenizer::bpe_tokenize_to_ids(), TinyLlamaModel::clear_layer_dequantized_weights(), Tokenizer::decode_sentencepiece(), dequantize_vector_q4k_to_f32(), dequantize_vector_q6k_to_f32(), dequantize_vector_q8_0_to_f32(), Tokenizer::encode(), CPUBatchProcessor::forward_cpu_batch(), tinyllama::TinyLlamaSession::generate(), tinyllama::TinyLlamaSession::generate_batch(), generate_bpe_merges_from_vocab_scores(), Tokenizer::ids_to_tokens(), KVCache::initialize(), KVCache::initialize_batch(), TinyLlamaModel::initialize_gpu_and_rope(), TinyLlamaModel::initialize_rope_freqs(), Tokenizer::load_bpe_merges_from_json(), SafeTensorsLoader::load_from_directory(), load_gguf_meta(), SafeTensorsLoader::load_model_config_from_json(), Tokenizer::load_sentencepiece_model(), Tokenizer::load_vocab_from_json(), main(), parse_model_config(), parse_model_config_from_gguf(), SafeTensorsLoader::parse_shard_metadata(), SafeTensorsLoader::SafeTensorsLoader(), TinyLlamaModel::smart_gemm_batch_cuda(), TinyLlamaModel::TinyLlamaModel(), TinyLlamaModel::TinyLlamaModel(), tinyllama::TinyLlamaSession::TinyLlamaSession(), Tokenizer::Tokenizer(), and Tokenizer::Tokenizer().
|
staticprivate |
Definition at line 94 of file logger.h.
Referenced by enable_console(), and log_internal().
|
staticprivate |
Definition at line 91 of file logger.h.
Referenced by get_level(), log_internal(), and set_level().
|
staticprivate |
Definition at line 93 of file logger.h.
Referenced by ensure_logfile_open_and_truncated(), and set_logfile().
|
staticprivate |
Definition at line 92 of file logger.h.
Referenced by ensure_logfile_open_and_truncated(), fatal(), log_internal(), and set_logfile().
|
staticprivate |
Definition at line 95 of file logger.h.
Referenced by ensure_logfile_open_and_truncated(), and set_logfile().