Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NixOS compatibility (via nix-shell) #36

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

deftdawg
Copy link

  • create shell.nix build environment for NixOS
  • Update Torch and Numpy versions
  • Skip cert generation if private key already exists
  • Add instructions to build and run in a Nix shell (NixOS)

It runs as it is...

To do:

  • update RoCM upgrade script (don't have a Cuda card to test NVIDIA)
  • fix TC Malloc for NixOS compatibility in webui.sh

@Woolverine94 Woolverine94 self-assigned this Aug 27, 2024
@Woolverine94 Woolverine94 added the enhancement New feature or request label Aug 27, 2024
@Woolverine94
Copy link
Owner

Hello @deftdawg,

Thanks for your PR and your interest in the project.

I will need some time to review your code and make some tests.

I can already say you that the use of torch==2.2.0 will break audiocraft-based modules, and it is not an option.
If it's a pre-requisite for use on NixOS, then it's a no go.

Same for the update of numpy to 1.26.4 : bad idea ...

Thanks again

@deftdawg
Copy link
Author

No worries, I bumped numpy to 1.26.4 because my install was defaulting to Python 3.12, eventually I had to downgrade to 3.11, I'll see about reverting that when I have another go to see if I can get RoCM running.

Leave it open til I get a chance to work on it some more (or cherry pick parts of it). All good 😀

@Woolverine94
Copy link
Owner

Python 3.12 won't work with torch==2.1.0 :( ... (at least not on systems i've deployed biniou).

Leave it open til I get a chance to work on it some more (or cherry pick parts of it). All good 😀

Of course ! I'll be really happy to merge your PR if we can find a way to make it work efficiently !

And you can take your time, as I've very few time to work on biniou these days ...

…e with NixOS

- create shell.nix build environment for NixOS
- Skip cert generation if private key already exists
- Add instructions to build and run in a Nix shell (NixOS)
@Woolverine94
Copy link
Owner

@deftdawg,

Thanks for your modifications.

I'll watch it asap, but be patient : there's a lot of things I want to test before merging your pull request.

@deftdawg
Copy link
Author

No worries, I'm still poking away at it gonna try to get RoCM going and maybe intel arc since I have those 2 GPUs on hand

@@ -12,17 +12,18 @@ mkdir -p ./ssl
mkdir -p ./models/Audiocraft

## Creating self-signed certificate
openssl req -x509 -newkey rsa:4096 -keyout ./ssl/key.pem -out ./ssl/cert.pem -sha256 -days 3650 -nodes -subj "/C=FR/ST=Paris/L=Paris/O=Biniou/OU=/CN="
[ ! -e ./ssl/key.pem ] && openssl req -x509 -newkey rsa:4096 -keyout ./ssl/key.pem -out ./ssl/cert.pem -sha256 -days 3650 -nodes -subj "/C=FR/ST=Paris/L=Paris/O=Biniou/OU=/CN="
Copy link
Owner

Choose a reason for hiding this comment

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

Sorry for not seeing it before : don't do that. There's zero reasons for this certificate to exist, as this is script is not handling at all an existing installation.


## Creating virtual environment
eval $PYTHON_VER -m venv ./env
source ./env/bin/activate

## Install packages :
set -e # stop if any command below fails
Copy link
Owner

Choose a reason for hiding this comment

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

Don't do that : warnings in the installation of some components sometimes gives useful hints for debugging. Blame is on my installer, that should handle correctly failures.

pip install -r requirements.txt
FORCE_CMAKE=1 pip install llama-cpp-python
Copy link
Owner

Choose a reason for hiding this comment

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

See following comment.

pip install -r requirements.txt
FORCE_CMAKE=1 pip install llama-cpp-python
# pip install torch==2.1.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
Copy link
Owner

Choose a reason for hiding this comment

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

Definitely don't do that !
Installation order is important. I don't want it to be changed.
Also, torch==2.1.0 is mandatory and should be forced. Don't comment it, please.

If all the changes you made in install.sh (except for the shebang) have a real interest for NixOS, please provide a specific install_nix.sh and update documentation.

Copy link
Owner

Choose a reason for hiding this comment

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

Need to be tested, but Ok for that.

Copy link
Owner

Choose a reason for hiding this comment

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

Need to be tested, but Ok for that.

Copy link
Owner

Choose a reason for hiding this comment

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

Need to be tested, but Ok for that.

Copy link
Owner

Choose a reason for hiding this comment

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

Need to be tested, but Ok for that.

Copy link
Owner

Choose a reason for hiding this comment

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

Need to be tested, but Ok for that.

Copy link
Owner

Choose a reason for hiding this comment

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

Need to be tested and rebased, but Ok for that.
Very nice work by the way ! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants