Skip to content

Tabby: bump 0.7.0 -> 0.8.3 and add systemd service - #292873

Merged
happysalada merged 2 commits into
NixOS:masterfrom
ghthor:tabby
Mar 7, 2024
Merged

Tabby: bump 0.7.0 -> 0.8.3 and add systemd service#292873
happysalada merged 2 commits into
NixOS:masterfrom
ghthor:tabby

Conversation

@ghthor

@ghthor ghthor commented Mar 2, 2024

Copy link
Copy Markdown
Contributor

Description of changes

  1. followup to tabby: init at 0.7.0 take 2 #291744
  2. Upgraded tabby to release 0.8.3
  3. Replaced static linking of vendored llama-cpp with dynamic link to llama-cpp from nixpkgs
  4. Add systemd service for [tabby, tabby-scheduler] with timer configuration for tabby scheduler

Upgraded to upstream 0.8.3 release

Added support for rocm AMD acceleration.

  • tested rocm acceleration locally with AMD Radeon RX 560 Series
  • tested cuda acceleration locally with NVIDIA Geforce RTX 2080 SUPER
  • tested darwin metal on an M1 macbook

Both tests used the new systemd service to run tabby

Dynamic Linking w/ llama-cpp

I was having compile errors with the vendored copy of llama-cpp that tabbyml was statically compiling, so I switched to dynamic linking with the llama-cpp that is within nixpkgs.

Systemd service

Example of the configuration required here.

https://github.com/ghthor/shrc/blob/18109599c526e580e54b11a16b6c1ef017777918/nix/cryptnix/configuration.nix#L434

  services.tabby = {
    enable = true;
    acceleration = "cuda";
    model = "TabbyML/StarCoder-3B";

    settings = {
      repositories = [
        {
          # Has to be created/updated manually, and permissions corrected
          git_url = "file:///var/lib/tabby/source_repo";
        }
      ];
    };
  };

Using the service makes it easy to enable a specific type of acceleration.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions Bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Mar 2, 2024
@ghthor ghthor mentioned this pull request Mar 2, 2024
13 tasks
@ghthor

ghthor commented Mar 2, 2024

Copy link
Copy Markdown
Contributor Author

@sersorrel I was able to test the rocm support on my local workstation, still pinging you if you'd like to test as well.

@ghthor

ghthor commented Mar 2, 2024

Copy link
Copy Markdown
Contributor Author

@happysalada ready for review

@ofborg ofborg Bot added 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Mar 2, 2024

@happysalada happysalada left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good, thank you !
I have a couple of questions / comments

Comment thread nixos/modules/services/misc/tabby.nix Outdated
Comment thread nixos/modules/services/misc/tabby.nix Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind if we took the defaults from config.supportCuda and supportRocm. I dont think we need to have this manually configurable. If the user has cuda enabled use cuda should be the easy default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I think that makes sense, will fix this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some defaulting of the acceleration type in the presence of either rocmSupport or cudaSupport on nixpkgs.config. Even with that defaulting I have left acceleration as a service and package configuration value to handle the case when both of the above are present, as we can't make a clear decision and we do have to pick a single option. See this comment I've added to the code where the llama-cpp package is overriden.

274d9b9#diff-abdbe2b562428d2ed485d33ee478cf9e126faae74d5cc60b48284c7c254ddf33R86

Comment thread nixos/modules/services/misc/tabby.nix Outdated
Comment thread nixos/modules/services/misc/tabby.nix Outdated
Comment thread pkgs/by-name/ta/tabby/package.nix Outdated

@keysmashes keysmashes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I built with nix-build -E 'with import ./. {}; tabby.override { acceleration = "rocm"; }', and ./result/bin/tabby serve --model TabbyML/StarCoder-1B --device rocm appeared to work fine.

What's the purpose of the modelDownload config? I didn't explicitly run tabby download, it just downloaded it automatically.

Comment thread nixos/modules/services/misc/tabby.nix Outdated
Comment thread nixos/modules/services/misc/tabby.nix Outdated
Comment thread nixos/modules/services/misc/tabby.nix Outdated
@ghthor

ghthor commented Mar 4, 2024

Copy link
Copy Markdown
Contributor Author

What's the purpose of the modelDownload config? I didn't explicitly run tabby download, it just downloaded it automatically.

Yep, I can remove this extra configuration. I started using tabby before June 1, 2023 when they added this commit[1], didn't realize

[1] TabbyML/tabby@ca077a3

@happysalada

Copy link
Copy Markdown
Contributor

This looks good to me, happy to leave this open 1 more day to give some more time to other people to take a look.

@de11n de11n left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extremely well done! A few small comments.

Comment thread nixos/modules/services/misc/tabby.nix Outdated
Comment thread nixos/modules/services/misc/tabby.nix Outdated
Comment thread pkgs/by-name/ta/tabby/package.nix Outdated
Comment thread pkgs/by-name/ta/tabby/package.nix Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels backward to mention NixOS module configuration in the warning of a specific package. Perhaps this validation deserves to be in the module instead. A shorter, less-verbose warning could be here instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that makes sense, I'll move this around

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better. Thanks. It looks like you have a trailing whitespace somewhere, causing the CI to fail.

@happysalada

Copy link
Copy Markdown
Contributor

pkgs/by-name/ta/tabby/package.nix:
70: Trailing whitespace

@happysalada

happysalada commented Mar 6, 2024

Copy link
Copy Markdown
Contributor

I just noticed the darwin x86_64 build is broken. Would you mind marking the build as broken for that platform ?

@ghthor

ghthor commented Mar 7, 2024

Copy link
Copy Markdown
Contributor Author

Alright, little searching I found this #140325 for reference on how to mark the package as broken which I think points to it being a boolean flag in the meta object.

I don't have hardware to test linux-aarch64, but I will soon as that's what I'd like to try and run this on at work.

ghthor added 2 commits March 7, 2024 06:27
- Added support for AMD ROCm accleration
- Added support for Darwin Aarch64 Metal acceleration

https://github.com/TabbyML/tabby/releases/tag/v0.8.3
- Enable tabby to run as a systemd service
- Document standard tabby configuration
@ghthor ghthor changed the title Tabby: bump 0.7.0 => 0.8.3 and add systemd service Tabby: bump 0.7.0 -> 0.8.3 and add systemd service Mar 7, 2024
@ghthor

ghthor commented Mar 7, 2024

Copy link
Copy Markdown
Contributor Author

@happysalada

Copy link
Copy Markdown
Contributor

Perfect thanks ! I plan on merging this when i go home today.

@delroth delroth added the 12.approvals: 1 This PR was reviewed and approved by one person. label Mar 7, 2024
@happysalada
happysalada merged commit 0340f82 into NixOS:master Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants