[gguf] Add date

This commit is contained in:
akawrykow 2023-08-22 17:25:04 -07:00
parent 46ef5b5fcf
commit 684686eadb
2 changed files with 6 additions and 0 deletions

View file

@ -22,6 +22,7 @@ import numpy as np
from abc import ABCMeta, abstractmethod
from dataclasses import dataclass
from datetime import datetime
from pathlib import Path
from typing import (IO, TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Literal, Optional, Sequence, Tuple, TypeVar, Union)
from sentencepiece import SentencePieceProcessor # type: ignore
@ -734,6 +735,7 @@ class OutputFile:
def add_meta_arch(self, params: Params) -> None:
self.gguf.add_name ("LLaMA")
self.gguf.add_date(datetime.today().isoformat())
self.gguf.add_context_length (params.n_ctx)
self.gguf.add_embedding_length (params.n_embd)
self.gguf.add_block_count (params.n_layer)

View file

@ -27,6 +27,7 @@ KEY_GENERAL_LICENSE = "general.license"
KEY_GENERAL_SOURCE_URL = "general.source.url"
KEY_GENERAL_SOURCE_HF_REPO = "general.source.hugginface.repository"
KEY_GENERAL_FILE_TYPE = "general.file_type"
KEY_GENERAL_DATE = "general.date"
# LLM
KEY_LLM_CONTEXT_LENGTH = "{arch}.context_length"
@ -599,6 +600,9 @@ class GGUFWriter:
def add_file_type(self, ftype: int):
self.add_uint32(KEY_GENERAL_FILE_TYPE, ftype)
def add_date(self, date: str):
self.add_string(KEY_GENERAL_DATE, date)
def add_name(self, name: str):
self.add_string(KEY_GENERAL_NAME, name)