From 684686eadbe101394ee294f2db5d679d6812f23e Mon Sep 17 00:00:00 2001 From: akawrykow Date: Tue, 22 Aug 2023 17:25:04 -0700 Subject: [PATCH] [gguf] Add date --- convert.py | 2 ++ gguf.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/convert.py b/convert.py index e720889fd..ef5d4cc9d 100644 --- a/convert.py +++ b/convert.py @@ -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) diff --git a/gguf.py b/gguf.py index 465746718..07a4c2d02 100644 --- a/gguf.py +++ b/gguf.py @@ -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)