Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
  • Loading branch information
sozercan committed Jun 10, 2024
1 parent 245da03 commit 980fdda
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 26 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
deb.debian.org:80
developer.download.nvidia.com:443
get.helm.sh:443
*.blob.core.windows.net:443
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
deb.debian.org:80
developer.download.nvidia.com:443
get.helm.sh:443
*.blob.core.windows.net:443
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

Expand Down
2 changes: 0 additions & 2 deletions pkg/aikit2llb/finetune/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
)

const (
// https://github.com/unslothai/unsloth/pull/366
// https://github.com/unslothai/unsloth/issues/356
unslothCommitSHA = "2e1cb3888b2b6c9ea3bca56e808d0604b715f23a"
nvidiaMknod = "mknod --mode 666 /dev/nvidiactl c 195 255 && mknod --mode 666 /dev/nvidia-uvm c 235 0 && mknod --mode 666 /dev/nvidia-uvm-tools c 235 1 && mknod --mode 666 /dev/nvidia0 c 195 0 && nvidia-smi"
sourceVenv = ". .venv/bin/activate"
Expand Down
19 changes: 8 additions & 11 deletions pkg/aikit2llb/inference/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,16 @@ func installCuda(c *config.InferenceConfig, s llb.State, merge llb.State) (llb.S

// addLocalAI adds the LocalAI binary to the image.
func addLocalAI(s llb.State, merge llb.State, platform specs.Platform) (llb.State, llb.State, error) {
var binaryName string
var localAIURL string
switch platform.Architecture {
case utils.PlatformAMD64:
binaryName = "local-ai-Linux-x86_64"
localAIURL = fmt.Sprintf("https://github.com/mudler/LocalAI/releases/download/%[1]s/%[2]s", localAIVersion, binaryName)
case utils.PlatformARM64:
// TODO: update this URL when the binary is available
binaryName = "local-ai-Linux-arm64"
localAIURL = fmt.Sprintf("http://sertac-vm:8889/%s", binaryName)
default:
binaryNames := map[string]string{
utils.PlatformAMD64: "local-ai-Linux-x86_64",
utils.PlatformARM64: "local-ai-Linux-arm64",
}
binaryName, exists := binaryNames[platform.Architecture]
if !exists {
return s, merge, fmt.Errorf("unsupported architecture %s", platform.Architecture)
}
// TODO: update this URL when the binary is available in github
localAIURL := fmt.Sprintf("https://sertacstoragevs.blob.core.windows.net/localai/%[1]s/%[2]s", localAIVersion, binaryName)

savedState := s

Expand Down
20 changes: 10 additions & 10 deletions pkg/aikit2llb/inference/stablediffusion.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ import (
)

func installOpenCV(s llb.State, merge llb.State, platform specs.Platform) llb.State {
savedState := s
// adding debian 11 (bullseye) repo due to opencv 4.5 requirement
s = s.Run(utils.Sh("echo 'deb http://deb.debian.org/debian bullseye main' | tee -a /etc/apt/sources.list")).Root()
// pinning libdap packages to bullseye version due to symbol error
libdapVersion := "3.20.7-6"

var libPath string
switch platform.Architecture {
case utils.PlatformAMD64:
libPath = "/usr/lib/x86_64-linux-gnu"
case utils.PlatformARM64:
libPath = "/usr/lib/aarch64-linux-gnu"
libPaths := map[string]string{
utils.PlatformAMD64: "/usr/lib/x86_64-linux-gnu",
utils.PlatformARM64: "/usr/lib/aarch64-linux-gnu",
}
libPath, exists := libPaths[platform.Architecture]
if !exists {
return s
}

savedState := s
// adding debian 11 (bullseye) repo due to opencv 4.5 requirement
s = s.Run(utils.Sh("echo 'deb http://deb.debian.org/debian bullseye main' | tee -a /etc/apt/sources.list")).Root()
s = s.Run(utils.Shf("apt-get update && mkdir -p /tmp/generated/images && apt-get install --no-install-recommends -y curl unzip ca-certificates libopencv-imgcodecs4.5 libgomp1 libdap27=%[1]s libdapclient6v5=%[1]s && apt-get clean && ln -s %[2]s/libopencv_core.so.4.5 %[2]s/libopencv_core.so.4.5d && ln -s %[2]s/libopencv_core.so.4.5 %[2]s/libopencv_core.so.406 && ln -s %[2]s/libopencv_imgcodecs.so.4.5 %[2]s/libopencv_imgcodecs.so.4.5d", libdapVersion, libPath), llb.IgnoreCache).Root()
diff := llb.Diff(savedState, s)
merge = llb.Merge([]llb.State{merge, diff})
Expand Down
6 changes: 3 additions & 3 deletions pkg/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func buildInference(ctx context.Context, c client.Client, cfg *config.InferenceC
MultiPlatformRequested: isMultiPlatform,
CacheImports: cacheImports,
},
}, cacheImports)
})
if err != nil {
return errors.Wrap(err, "failed to build image")
}
Expand Down Expand Up @@ -194,7 +194,7 @@ func (br *buildResult) AddToClientResult(cr *client.Result) {
}

// buildImage builds an image from the given aikitfile config.
func buildImage(ctx context.Context, c client.Client, cfg *config.InferenceConfig, convertOpts *d2llb.ConvertOpt, cacheImports []client.CacheOptionsEntry) (*buildResult, error) {
func buildImage(ctx context.Context, c client.Client, cfg *config.InferenceConfig, convertOpts *d2llb.ConvertOpt) (*buildResult, error) {
result := buildResult{
Platform: convertOpts.TargetPlatform,
MultiPlatform: convertOpts.MultiPlatformRequested,
Expand All @@ -217,7 +217,7 @@ func buildImage(ctx context.Context, c client.Client, cfg *config.InferenceConfi

res, err := c.Solve(ctx, client.SolveRequest{
Definition: def.ToPB(),
CacheImports: cacheImports,
CacheImports: convertOpts.CacheImports,
})
if err != nil {
return nil, errors.Wrap(err, "failed to solve")
Expand Down

0 comments on commit 980fdda

Please sign in to comment.