|
1 |
| -<Project Sdk="Microsoft.NET.Sdk"> |
| 1 | +<Project Sdk="Microsoft.NET.Sdk"> |
2 | 2 | <Import Project="..\LLama\LLamaSharp.Runtime.targets" />
|
3 | 3 | <PropertyGroup>
|
4 | 4 | <TargetFramework>net8.0</TargetFramework>
|
|
25 | 25 | <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
26 | 26 | <PrivateAssets>all</PrivateAssets>
|
27 | 27 | </PackageReference>
|
| 28 | + <PackageReference Include="Xunit.SkippableFact" Version="1.5.23" /> |
28 | 29 | </ItemGroup>
|
29 | 30 |
|
30 |
| - <Target Name="DownloadContentFilesInner"> |
31 |
| - |
32 |
| - <DownloadFile SourceUrl="https://huggingface.co/bartowski/Llama-3.2-1B-Instruct-GGUF/resolve/main/Llama-3.2-1B-Instruct-Q4_0.gguf" DestinationFolder="Models" DestinationFileName="Llama-3.2-1B-Instruct-Q4_0.gguf" SkipUnchangedFiles="true"> |
33 |
| - </DownloadFile> |
| 31 | + <!-- Define each file to download. |
| 32 | + The Include value is just an identifier. |
| 33 | + SourceUrl is the remote URL. |
| 34 | + DestinationFolder is where you want it saved. |
| 35 | + LocalFileName is the desired file name. --> |
| 36 | + <ItemGroup> |
| 37 | + <DownloadFileItem Include="Llama-3.2-1B-Instruct-Q4_0"> |
| 38 | + <SourceUrl>https://huggingface.co/bartowski/Llama-3.2-1B-Instruct-GGUF/resolve/main/Llama-3.2-1B-Instruct-Q4_0.gguf</SourceUrl> |
| 39 | + <DestinationFolder>Models</DestinationFolder> |
| 40 | + <LocalFileName>Llama-3.2-1B-Instruct-Q4_0.gguf</LocalFileName> |
| 41 | + </DownloadFileItem> |
34 | 42 |
|
35 |
| - <DownloadFile SourceUrl="https://huggingface.co/HuggingFaceTB/smollm-360M-instruct-v0.2-Q8_0-GGUF/resolve/main/smollm-360m-instruct-add-basics-q8_0.gguf" DestinationFolder="Models" DestinationFileName="smollm-360m-instruct-add-basics-q8_0.gguf" SkipUnchangedFiles="true"> |
36 |
| - </DownloadFile> |
| 43 | + <DownloadFileItem Include="smollm-360m-instruct-add-basics-q8_0"> |
| 44 | + <SourceUrl>https://huggingface.co/HuggingFaceTB/smollm-360M-instruct-v0.2-Q8_0-GGUF/resolve/main/smollm-360m-instruct-add-basics-q8_0.gguf</SourceUrl> |
| 45 | + <DestinationFolder>Models</DestinationFolder> |
| 46 | + <LocalFileName>smollm-360m-instruct-add-basics-q8_0.gguf</LocalFileName> |
| 47 | + </DownloadFileItem> |
37 | 48 |
|
38 |
| - <DownloadFile SourceUrl="https://huggingface.co/gpustack/jina-reranker-v1-tiny-en-GGUF/resolve/main/jina-reranker-v1-tiny-en-FP16.gguf" DestinationFolder="Models" DestinationFileName="jina-reranker-v1-tiny-en-FP16.gguf" SkipUnchangedFiles="true"> |
39 |
| - </DownloadFile> |
| 49 | + <DownloadFileItem Include="jina-reranker-v1-tiny-en-FP16.gguf"> |
| 50 | + <SourceUrl>https://huggingface.co/gpustack/jina-reranker-v1-tiny-en-GGUF/resolve/main/jina-reranker-v1-tiny-en-FP16.gguf</SourceUrl> |
| 51 | + <DestinationFolder>Models</DestinationFolder> |
| 52 | + <LocalFileName>jina-reranker-v1-tiny-en-FP16.gguf</LocalFileName> |
| 53 | + </DownloadFileItem> |
40 | 54 |
|
41 |
| - <DownloadFile SourceUrl="https://huggingface.co/cjpais/llava-1.6-mistral-7b-gguf/resolve/main/llava-v1.6-mistral-7b.Q3_K_XS.gguf" DestinationFolder="Models" DestinationFileName="llava-v1.6-mistral-7b.Q3_K_XS.gguf" SkipUnchangedFiles="true"> |
42 |
| - </DownloadFile> |
43 |
| - |
44 |
| - <DownloadFile SourceUrl="https://huggingface.co/cjpais/llava-1.6-mistral-7b-gguf/resolve/main/mmproj-model-f16.gguf" DestinationFolder="Models" DestinationFileName="mmproj-model-f16.gguf" SkipUnchangedFiles="true"> |
45 |
| - </DownloadFile> |
46 |
| - |
47 |
| - <DownloadFile SourceUrl="https://huggingface.co/leliuga/all-MiniLM-L12-v2-GGUF/resolve/main/all-MiniLM-L12-v2.Q8_0.gguf" DestinationFolder="Models" DestinationFileName="all-MiniLM-L12-v2.Q8_0.gguf" SkipUnchangedFiles="true"> |
48 |
| - </DownloadFile> |
| 55 | + <DownloadFileItem Include="llava-v1.6-mistral-7b"> |
| 56 | + <SourceUrl>https://huggingface.co/cjpais/llava-1.6-mistral-7b-gguf/resolve/main/llava-v1.6-mistral-7b.Q3_K_XS.gguf</SourceUrl> |
| 57 | + <DestinationFolder>Models</DestinationFolder> |
| 58 | + <LocalFileName>llava-v1.6-mistral-7b.Q3_K_XS.gguf</LocalFileName> |
| 59 | + </DownloadFileItem> |
49 | 60 |
|
50 |
| - </Target> |
51 |
| - |
52 |
| - <Target Name="DownloadContentFiles" BeforeTargets="DispatchToInnerBuilds;BeforeBuild"> |
53 |
| - <MSBuild Projects="$(MSBuildProjectFile)" Targets="DownloadContentFilesInner" Properties="TargetFramework=once" /> |
54 |
| - </Target> |
| 61 | + <DownloadFileItem Include="mmproj-model-f16"> |
| 62 | + <SourceUrl>https://huggingface.co/cjpais/llava-1.6-mistral-7b-gguf/resolve/main/mmproj-model-f16.gguf</SourceUrl> |
| 63 | + <DestinationFolder>Models</DestinationFolder> |
| 64 | + <LocalFileName>mmproj-model-f16.gguf</LocalFileName> |
| 65 | + </DownloadFileItem> |
55 | 66 |
|
56 |
| - <ItemGroup> |
| 67 | + <DownloadFileItem Include="all-MiniLM-L12-v2"> |
| 68 | + <SourceUrl>https://huggingface.co/leliuga/all-MiniLM-L12-v2-GGUF/resolve/main/all-MiniLM-L12-v2.Q8_0.gguf</SourceUrl> |
| 69 | + <DestinationFolder>Models</DestinationFolder> |
| 70 | + <LocalFileName>all-MiniLM-L12-v2.Q8_0.gguf</LocalFileName> |
| 71 | + </DownloadFileItem> |
| 72 | + </ItemGroup> |
| 73 | + |
| 74 | + <!-- Ensure the destination folder exists --> |
| 75 | + <Target Name="EnsureFolders"> |
| 76 | + <MakeDir Directories="Models" Condition="!Exists('Models')" /> |
| 77 | + </Target> |
| 78 | + |
| 79 | + <!-- Download a single file: |
| 80 | + - Computes the full target file name (DesiredFile). |
| 81 | + - If DesiredFile already exists, the download is skipped. |
| 82 | + - Otherwise, creates a temporary folder (TempDownload), |
| 83 | + downloads the file there using DownloadFile, and then moves it |
| 84 | + to DesiredFile. Finally, cleans up the temporary folder. --> |
| 85 | + <Target Name="DownloadSingleFile" DependsOnTargets="EnsureFolders"> |
| 86 | + <!-- (These properties come in via the MSBuild call.) --> |
| 87 | + <PropertyGroup> |
| 88 | + <DesiredFile>$([System.IO.Path]::Combine($(DestinationFolder), $(LocalFileName)))</DesiredFile> |
| 89 | + </PropertyGroup> |
| 90 | + |
| 91 | + <Message Text="Processing file: $(DesiredFile)" Importance="high" /> |
| 92 | + |
| 93 | + <!-- Define a flag based on whether the file already exists --> |
| 94 | + <PropertyGroup> |
| 95 | + <DownloadNeeded Condition="!Exists('$(DesiredFile)')">true</DownloadNeeded> |
| 96 | + <DownloadNeeded Condition="Exists('$(DesiredFile)')">false</DownloadNeeded> |
| 97 | + </PropertyGroup> |
| 98 | + <Message Text="Download needed: $(DownloadNeeded)" Importance="high" /> |
| 99 | + |
| 100 | + <!-- If the file is already present, skip the download (by simply exiting this target) --> |
| 101 | + <Message Text="File $(DesiredFile) already exists; skipping download." Importance="high" Condition=" '$(DownloadNeeded)'=='false' " /> |
| 102 | + |
| 103 | + <!-- Only download if required --> |
| 104 | + <DownloadFile SourceUrl="$(SourceUrl)" DestinationFolder="TempDownload" SkipUnchangedFiles="true" Condition=" '$(DownloadNeeded)'=='true' " /> |
| 105 | + |
| 106 | + <!-- If a file was downloaded, move it to the desired name. |
| 107 | + We assume TempDownload now contains the downloaded file. |
| 108 | + (You might want to refine this if TempDownload could ever contain multiple files.) --> |
| 109 | + <ItemGroup Condition=" '$(DownloadNeeded)'=='true' "> |
| 110 | + <TempFile Include="TempDownload/*.*" /> |
| 111 | + </ItemGroup> |
| 112 | + <Message Text="Downloaded file (temp): @(TempFile)" Importance="high" Condition=" '$(DownloadNeeded)'=='true' " /> |
| 113 | + <Move SourceFiles="@(TempFile)" DestinationFiles="$(DesiredFile)" Condition=" '$(DownloadNeeded)'=='true' and @(TempFile) != '' " /> |
| 114 | + <Message Text="Renamed downloaded file to $(DesiredFile)" Importance="high" Condition=" '$(DownloadNeeded)'=='true' and @(TempFile) != '' " /> |
| 115 | + |
| 116 | + <!-- Remove the temporary download folder --> |
| 117 | + <RemoveDir Directories="TempDownload" Condition="Exists('TempDownload')" /> |
| 118 | + </Target> |
| 119 | + |
| 120 | + <!-- Main target to process each file by calling the DownloadSingleFile target for each item. |
| 121 | + The MSBuild task will batch over the DownloadFileItem items, passing in each file’s metadata. --> |
| 122 | + <Target Name="DownloadAllFiles" BeforeTargets="DispatchToInnerBuilds;BeforeBuild"> |
| 123 | + <MSBuild Projects="$(MSBuildProjectFile)" Targets="DownloadSingleFile" Properties="SourceUrl=%(DownloadFileItem.SourceUrl);DestinationFolder=%(DownloadFileItem.DestinationFolder);LocalFileName=%(DownloadFileItem.LocalFileName);TargetFramework=once" /> |
| 124 | + </Target> |
| 125 | + |
| 126 | + <ItemGroup> |
57 | 127 | <ProjectReference Include="..\LLama.KernelMemory\LLamaSharp.KernelMemory.csproj" />
|
58 | 128 | <ProjectReference Include="..\LLama.SemanticKernel\LLamaSharp.SemanticKernel.csproj" />
|
59 | 129 | <ProjectReference Include="..\LLama\LLamaSharp.csproj" />
|
|
0 commit comments