From a4e5e833af49ad44c91a94a28a2dfbafc5f49510 Mon Sep 17 00:00:00 2001 From: Gorkem Ercan Date: Thu, 31 Oct 2024 10:15:56 -0400 Subject: [PATCH] Update descriptions for the functions Adds short and long descriptions. --- gguf/dagger/main.go | 9 ++++++++- huggingface/dagger/main.go | 7 +++++++ kit/dagger/main.go | 16 ++++++++++++++++ tests/main.go | 14 -------------- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/gguf/dagger/main.go b/gguf/dagger/main.go index 57c17d9..e276fd0 100644 --- a/gguf/dagger/main.go +++ b/gguf/dagger/main.go @@ -1,3 +1,10 @@ +// Dagger functions for working with GGUF format for AI/ML models. + +// ConvertToGGuf converts a model to GGUF format. +// Quantize applies quantization to a given model(gguf) file. +// +// Uses tools from llama.cpp project to perform the conversion and quantization. + package main import ( @@ -8,7 +15,7 @@ import ( const ( ggufConvertScript = "/app/convert_hf_to_gguf.py" llamacppImageRef = "ghcr.io/ggerganov/llama.cpp:full" - convertedFileName = "converted.gguf" + convertedFileName = "converted.gguf" quantizedFileName = "quantized.gguf" ) diff --git a/huggingface/dagger/main.go b/huggingface/dagger/main.go index cafceff..1cd2749 100644 --- a/huggingface/dagger/main.go +++ b/huggingface/dagger/main.go @@ -1,3 +1,10 @@ +// Dagger functions for downloading Huggingface repos and files. +// +// DownloadRepo downloads a Huggingface repo and returns the Directory to the downloaded repo. +// DownloadFile downloads a single file from Huggingface repo and returns the File. +// +// Uses the Huggingface CLI to download the repos and files. + package main import ( diff --git a/kit/dagger/main.go b/kit/dagger/main.go index 8cf56f8..2301e8a 100644 --- a/kit/dagger/main.go +++ b/kit/dagger/main.go @@ -1,3 +1,13 @@ +// Functions for working with ModelKits in Dagger +// +// ModelKit is an OCI-compliant packaging format, that +// encapsulates datasets, code, docs, configurations, and model weights +// into a single, standardized unit. +// +// See kitops.ml for more information. +// +// Uses the Kit CLI to pack, unpack, pull, push, and tag ModelKits. + package main import ( @@ -150,6 +160,7 @@ func (m *Kit) baseContainer(_ context.Context) (*dagger.Container, error) { return m.Container, nil } +// Authenticates the user with the remote registry func (m *Kit) WithAuth(ctx context.Context, username string, password *dagger.Secret) (*Kit, error) { cmd := []string{kitCommand, "login", "-v", m.Registry, "-u", username, "-p", "$KIT_PASSWORD"} if m.PlainHTTP { @@ -174,6 +185,7 @@ func (m *Kit) WithAuth(ctx context.Context, username string, password *dagger.Se return m, nil } +// Packs a directory into a ModelKit func (m *Kit) Pack(ctx context.Context, // directory to pack directory *dagger.Directory, @@ -202,6 +214,7 @@ func (m *Kit) Pack(ctx context.Context, return m, nil } +// Unpacks a ModelKit into a directory func (m *Kit) Unpack(ctx context.Context, // reference to the ModelKit reference string, @@ -228,6 +241,7 @@ func (m *Kit) Unpack(ctx context.Context, Directory("/unpack"), nil } +// Pulls a ModelKit from the registry func (m *Kit) Pull(ctx context.Context, reference string) (*Kit, error) { cmd := []string{kitCommand, "pull", reference} if m.PlainHTTP { @@ -246,6 +260,7 @@ func (m *Kit) Pull(ctx context.Context, reference string) (*Kit, error) { return m, nil } +// Pushes a ModelKit to the registry func (m *Kit) Push(ctx context.Context, reference string) error { cmd := []string{kitCommand, "push", reference} if m.PlainHTTP { @@ -265,6 +280,7 @@ func (m *Kit) Push(ctx context.Context, reference string) error { return nil } +// Tags a ModelKit func (m *Kit) Tag(ctx context.Context, currentRef string, newRef string) (*Kit, error) { cmd := []string{kitCommand, "tag", currentRef, newRef} if m.PlainHTTP { diff --git a/tests/main.go b/tests/main.go index 606074f..388da69 100644 --- a/tests/main.go +++ b/tests/main.go @@ -1,17 +1,3 @@ -// A generated module for HfToModelkit functions -// -// This module has been generated via dagger init and serves as a reference to -// basic module structure as you get started with Dagger. -// -// Two functions have been pre-created. You can modify, delete, or add to them, -// as needed. They demonstrate usage of arguments and return types using simple -// echo and grep commands. The functions can be called from the dagger CLI or -// from one of the SDKs. -// -// The first line in this comment block is a short description line and the -// rest is a long description with more detail on the module's purpose or usage, -// if appropriate. All modules should have a short description. - package main import (