Skip to content
Open
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
2 changes: 1 addition & 1 deletion grammars/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ castle ::= ...

## Non-Terminals and Terminals

Non-terminal symbols (rule names) stand for a pattern of terminals and other non-terminals. They are required to be a dashed lowercase word, like `move`, `castle`, or `check-mate`.
Non-terminal symbols (rule names) stand for a pattern of terminals and other non-terminals. Rule names can be composed of letters (both uppercase and lowercase), numbers, dashes, and underscores. For example: `move`, `castle`, `check-mate`, `dataType`, `UPPER-CASE`, or `rule_123` are all valid non-terminal names.

Terminals are actual characters ([code points](https://en.wikipedia.org/wiki/Code_point)). They can be specified as a sequence like `"1"` or `"O-O"` or as ranges like `[1-9]` or `[NBKQR]`.

Expand Down
14 changes: 12 additions & 2 deletions src/llama-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,18 @@ static std::string gguf_data_to_str(enum gguf_type type, const void * data, int
case GGUF_TYPE_INT32: return std::to_string(((const int32_t *)data)[i]);
case GGUF_TYPE_UINT64: return std::to_string(((const uint64_t *)data)[i]);
case GGUF_TYPE_INT64: return std::to_string(((const int64_t *)data)[i]);
case GGUF_TYPE_FLOAT32: return std::to_string(((const float *)data)[i]);
case GGUF_TYPE_FLOAT64: return std::to_string(((const double *)data)[i]);
case GGUF_TYPE_FLOAT32: {
std::ostringstream oss;
oss.imbue(std::locale::classic());
oss << ((const float *)data)[i];
return oss.str();
}
case GGUF_TYPE_FLOAT64: {
std::ostringstream oss;
oss.imbue(std::locale::classic());
oss << ((const double *)data)[i];
return oss.str();
}
case GGUF_TYPE_BOOL: return ((const bool *)data)[i] ? "true" : "false";
default: return format("unknown type %d", type);
}
Expand Down
Loading