95 lines
No EOL
2.9 KiB
Nix
95 lines
No EOL
2.9 KiB
Nix
{
|
|
description = "Progressive LLM Training for 松尾研LLMコンペ2025 (Minimal)";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
config = {
|
|
allowUnfree = true;
|
|
cudaSupport = true;
|
|
};
|
|
};
|
|
|
|
# Python 3.11 for better compatibility
|
|
python = pkgs.python311;
|
|
|
|
# Minimal Python packages
|
|
pythonWithPackages = python.withPackages (ps: with ps; [
|
|
# Core essentials only
|
|
torch
|
|
transformers
|
|
numpy
|
|
|
|
# Essential dependencies
|
|
pyyaml
|
|
|
|
# Build tools
|
|
pip
|
|
setuptools
|
|
wheel
|
|
]);
|
|
|
|
in
|
|
{
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = with pkgs; [
|
|
# Python with packages
|
|
pythonWithPackages
|
|
|
|
# Build tools
|
|
gcc
|
|
cmake
|
|
ninja
|
|
pkg-config
|
|
|
|
# Git
|
|
git
|
|
git-lfs
|
|
|
|
# Libraries needed for Python packages
|
|
openssl
|
|
zlib
|
|
glib
|
|
stdenv.cc.cc.lib
|
|
|
|
# CUDA support
|
|
cudaPackages.cudatoolkit
|
|
cudaPackages.cudnn
|
|
];
|
|
|
|
shellHook = ''
|
|
echo "🚀 Progressive LLM Training Environment (Minimal)"
|
|
echo "Python version: $(python --version)"
|
|
echo "PyTorch version: $(python -c 'import torch; print(torch.__version__)')"
|
|
echo "CUDA available: $(python -c 'import torch; print(torch.cuda.is_available())')"
|
|
|
|
# Set up CUDA environment
|
|
export CUDA_HOME=${pkgs.cudaPackages.cudatoolkit}
|
|
export CUDA_PATH=${pkgs.cudaPackages.cudatoolkit}
|
|
export LD_LIBRARY_PATH=${pkgs.cudaPackages.cudatoolkit}/lib:${pkgs.cudaPackages.cudnn}/lib:${pkgs.stdenv.cc.cc.lib}/lib:$LD_LIBRARY_PATH
|
|
|
|
# Set Python path
|
|
export PYTHONPATH=$PWD/src:$PYTHONPATH
|
|
|
|
echo ""
|
|
echo "Note: This is a minimal configuration. Install additional packages with pip as needed:"
|
|
echo " pip install accelerate peft trl datasets bitsandbytes wandb jsonlines scikit-learn sentencepiece protobuf"
|
|
echo " pip install flash-attn --no-build-isolation"
|
|
'';
|
|
|
|
# Environment variables
|
|
CUDA_HOME = "${pkgs.cudaPackages.cudatoolkit}";
|
|
CUDA_PATH = "${pkgs.cudaPackages.cudatoolkit}";
|
|
NIX_SHELL_PRESERVE_PROMPT = 1;
|
|
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
|
LC_ALL = "en_US.UTF-8";
|
|
};
|
|
});
|
|
} |