
* add controlnet to pipeline * add cli params * control strength cli param * cli param keep controlnet in cpu * add Textual Inversion * add canny preprocessor * refactor: change ggml_type_sizef to ggml_row_size * process hint once time * ignore the embedding name case --------- Co-authored-by: leejet <leejet714@gmail.com>
39 lines
1.4 KiB
C++
39 lines
1.4 KiB
C++
#ifndef __UTIL_H__
|
|
#define __UTIL_H__
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
#include "stable-diffusion.h"
|
|
|
|
bool ends_with(const std::string& str, const std::string& ending);
|
|
bool starts_with(const std::string& str, const std::string& start);
|
|
|
|
std::string format(const char* fmt, ...);
|
|
|
|
void replace_all_chars(std::string& str, char target, char replacement);
|
|
|
|
bool file_exists(const std::string& filename);
|
|
bool is_directory(const std::string& path);
|
|
std::string get_full_path(const std::string& dir, const std::string& filename);
|
|
|
|
std::u32string utf8_to_utf32(const std::string& utf8_str);
|
|
std::string utf32_to_utf8(const std::u32string& utf32_str);
|
|
std::u32string unicode_value_to_utf32(int unicode_value);
|
|
|
|
std::string sd_basename(const std::string& path);
|
|
|
|
std::string path_join(const std::string& p1, const std::string& p2);
|
|
|
|
void pretty_progress(int step, int steps, float time);
|
|
|
|
void log_printf(sd_log_level_t level, const char* file, int line, const char* format, ...);
|
|
|
|
std::string trim(const std::string& s);
|
|
|
|
#define LOG_DEBUG(format, ...) log_printf(SD_LOG_DEBUG, __FILE__, __LINE__, format, ##__VA_ARGS__)
|
|
#define LOG_INFO(format, ...) log_printf(SD_LOG_INFO, __FILE__, __LINE__, format, ##__VA_ARGS__)
|
|
#define LOG_WARN(format, ...) log_printf(SD_LOG_WARN, __FILE__, __LINE__, format, ##__VA_ARGS__)
|
|
#define LOG_ERROR(format, ...) log_printf(SD_LOG_ERROR, __FILE__, __LINE__, format, ##__VA_ARGS__)
|
|
#endif // __UTIL_H__
|