@@ -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