-
Notifications
You must be signed in to change notification settings - Fork 13
Dynamic KV Overrides
leafspark edited this page Sep 5, 2024
·
2 revisions
Simply use one of these as the text in your str
override (can be used anywhere, and multiple can be used per string):
dynamic_params = {
"{system.time.milliseconds}": lambda: str(int(time.time() * 1000)),
"{system.time.seconds}": lambda: str(int(time.time())),
"{system.date.iso}": lambda: datetime.now().strftime("%Y-%m-%d"),
"{system.datetime.iso}": lambda: datetime.now().isoformat(),
"{system.username}": lambda: os.getlogin(),
"{system.hostname}": lambda: socket.gethostname(),
"{system.platform}": lambda: platform.system(),
"{system.python.version}": lambda: platform.python_version(),
"{system.timezone}": lambda: time.tzname[time.daylight],
"{system.cpus}": lambda: str(os.cpu_count()),
"{system.memory.total}": lambda: str(psutil.virtual_memory().total),
"{system.memory.free}": lambda: str(psutil.virtual_memory().free),
"{system.filesystem.used}": lambda: str(shutil.disk_usage("/").used),
"{system.kernel.version}": lambda: platform.release(),
"{system.locale}": lambda: locale.getdefaultlocale()[0],
"{process.nice}": lambda: str(os.nice(0)),
"{model.name}": lambda: (
model_name if model_name is not None else "Unknown Model"
),
"{quant.type}": lambda: (
quant_type if quant_type is not None else "Unknown Quant"
),
"{output.path}": lambda: (
output_path if output_path is not None else "Unknown Output Path"
),
"{quant.kv}": lambda: (
quantization_parameters[0]
if quantization_parameters is not None
else False
),
"{quant.requantized}": lambda: (
quantization_parameters[1]
if quantization_parameters is not None
else False
),
"{quant.leave_output_tensor}": lambda: (
quantization_parameters[2]
if quantization_parameters is not None
else False
),
}