Skip to content

Commit

Permalink
merged updated class lib template
Browse files Browse the repository at this point in the history
  • Loading branch information
lostmsu committed Sep 14, 2024
2 parents 0a946c4 + 8444c3b commit ed7bf5d
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 18 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Master

on:
push:
branches:
- master
pull_request:

jobs:
build-test:
name: Build and Test
runs-on: ${{ matrix.os }}-latest

strategy:
matrix:
os: [windows, ubuntu, macos]

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'

- name: Deps
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore

- name: Test
run: dotnet test --no-restore --verbosity normal
1 change: 1 addition & 0 deletions MinGPT.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CI", "CI", "{8C3BD3D9-5F7E-4622-80E3-45BF5190320E}"
ProjectSection(SolutionItems) = preProject
CI\Azure-Master.yml = CI\Azure-Master.yml
.github\workflows\master.yml = .github\workflows\master.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinGPT", "src\MinGPT.csproj", "{04BE1707-4235-44E6-AB58-48621D5160D3}"
Expand Down
4 changes: 2 additions & 2 deletions app/app.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<AssemblyName>minGPT</AssemblyName>
<RootNamespace>LostTech.Torch.NN</RootNamespace>
<LangVersion>10.0</LangVersion>
<LangVersion>12.0</LangVersion>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

Expand Down
5 changes: 5 additions & 0 deletions src/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
global using System;
global using System.Collections.Generic;
global using System.Linq;
global using System.Threading;
global using System.Threading.Tasks;

global using TorchSharp;
global using TorchSharp.Modules;

// for FormattableString.Invariant
global using static System.FormattableString;
10 changes: 5 additions & 5 deletions src/MinGPT.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<PropertyGroup>
<AssemblyName>LostTech.Torch.MinGPT</AssemblyName>
<RootNamespace>LostTech.Torch.NN</RootNamespace>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>10.0</LangVersion>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>12.0</LangVersion>
<VersionPrefix>0.3.0</VersionPrefix>
<Nullable>enable</Nullable>

Expand All @@ -13,7 +13,8 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageProjectUrl>https://github.com/losttech/Torch.MinGPT</PackageProjectUrl>
<PackageTags>PyTorch;TorchSharp;text-processing;deep-learning;ML;AI;GPT;text-completion;transformer;NLP</PackageTags>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageLicenseFile Condition="$(PackageLicenseExpression) == ''">LICENSE</PackageLicenseFile>
<Authors>Victor Nova</Authors>
<Company>Lost Tech LLC</Company>
<Product>LostTech.Torch</Product>
Expand All @@ -22,8 +23,7 @@
<!-- The following is recommended for public projects -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<DebugSymbols>true</DebugSymbols>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<DebugType>embedded</DebugType>
<RepositoryUrl>https://github.com/losttech/Torch.MinGPT.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>
Expand Down
13 changes: 13 additions & 0 deletions test/ImplicitUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
global using System;
global using System.Collections.Generic;
global using System.Linq;
global using System.Threading;
global using System.Threading.Tasks;

global using TorchSharp;
global using TorchSharp.Modules;

global using Xunit;

// for FormattableString.Invariant
global using static System.FormattableString;
10 changes: 5 additions & 5 deletions test/MinGPT.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>LostTech.Torch.NN</RootNamespace>

<IsPackable>false</IsPackable>

<LangVersion>10.0</LangVersion>
<LangVersion>12.0</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="libtorch-cpu" Version="1.13.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
7 changes: 1 addition & 6 deletions test/SirenTests.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
namespace LostTech.Torch.NN {
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;

using TorchSharp;

using Xunit;
using static ImageTools;
using static TorchSharp.torch.nn;

public partial class SirenTests {
[Fact]
public Module CanLearn() {
public void CanLearn() {
torch.random.manual_seed(119);

var thisAssembly = System.Reflection.Assembly.GetExecutingAssembly();
Expand Down Expand Up @@ -55,7 +51,6 @@ public Module CanLearn() {
using var recall = model.forward(coords);
double recallLoss = loss.forward(recall, trainImage).mean().ToDouble();
Assert.True(recallLoss < 0.25, recallLoss.ToString());
return model;
}

[ModuleInitializer]
Expand Down

0 comments on commit ed7bf5d

Please sign in to comment.