Skip to content

Commit 1fd029e

Browse files
committed
Add support for using unquantized models in the GGUF format from the source
1 parent 49edaf6 commit 1fd029e

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.3.0] - 2024-02-22
8+
9+
### Added
10+
- Add support for using unquantized models in the GGUF format from the source
11+
712
## [1.2.0] - 2024-02-20
813

914
### Added

quantize_weights_for_llama.cpp.ps1

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,17 @@ ForEach ($repositoryName in $repositoryDirectories) {
4040

4141
Write-Host "Working on ${repositoryName}..." -ForegroundColor "DarkYellow"
4242

43-
$unquantizedModelPath = Join-Path -Path $cacheDirectory -ChildPath "${repositoryName}.unquantized.gguf"
43+
$unquantizedModelPath = Join-Path -Path $cacheDirectory -ChildPath "${repositoryName}.gguf"
4444
$importanceMatrixPath = Join-Path -Path $cacheDirectory -ChildPath "${repositoryName}.importance-matrix.dat"
4545

46+
# If a repository already contains an unquantized GGUF file we are using it directly.
47+
$unquantizedModelPathFromSource = Join-Path -Path $sourceDirectory -ChildPath $repositoryName | Join-Path -ChildPath "${repositoryName}.gguf"
48+
$unqantizedModelAvailableInSource = (Test-Path -Path $unquantizedModelPathFromSource)
49+
if ($unqantizedModelAvailableInSource) {
50+
Write-Host "Found unquantized model $unquantizedModelPathFromSource in source, skipping conversion..." -ForegroundColor "DarkYellow"
51+
$unquantizedModelPath = $unquantizedModelPathFromSource
52+
}
53+
4654
ForEach ($type in $quantizationTypes) {
4755

4856
$quantizedModelPath = Join-Path -Path $targetDirectoryPath -ChildPath "${repositoryName}.${type}.gguf"
@@ -100,13 +108,16 @@ ForEach ($repositoryName in $repositoryDirectories) {
100108
}
101109
}
102110

103-
# Note that we are not removing *.importance-matrix.dat files because
104-
# they are relatively small but take a _very_ long time to compute.
105-
if (Test-Path -Path $unquantizedModelPath) {
111+
# We are exclusively removing unqantized models we created.
112+
# An unquantized model in the repository is left untouched.
113+
if ((Test-Path -Path $unquantizedModelPath) -and !($unqantizedModelAvailableInSource)) {
106114

107115
Write-Host "Removing intermediate unquantized model ${unquantizedModelPath}..." -ForegroundColor "DarkYellow"
108116
Remove-Item "${unquantizedModelPath}" -Recurse -Force
109117
}
118+
119+
# Note that we are not removing *.importance-matrix.dat files because
120+
# they are relatively small but take a _very_ long time to compute.
110121
}
111122

112123
$stopwatch.Stop()

0 commit comments

Comments
 (0)