File size: 1,961 Bytes
7d05c8f
c3add7a
3d31f05
 
 
 
 
 
 
 
 
 
 
 
946af1b
 
3d31f05
7d05c8f
7c8246b
 
c3add7a
7d05c8f
c3add7a
7d05c8f
 
 
 
 
 
c3add7a
7d05c8f
c3add7a
 
 
1cffa46
c3add7a
 
 
 
 
 
 
 
 
 
 
6aa3a4d
7d05c8f
 
c3add7a
a39b430
c3add7a
55896e3
a39b430
946af1b
a39b430
c3add7a
a39b430
7d05c8f
a39b430
c3add7a
 
7d05c8f
 
6aa3a4d
7d05c8f
 
 
c3add7a
6aa3a4d
7d05c8f
c3add7a
52da243
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 as builder

ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1

# Install system dependencies as root
RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    git-lfs \
    wget \
    curl \
    ca-certificates \
    build-essential \
    libsndfile1 \
    && rm -rf /var/lib/apt/lists/* \
    && git lfs install --system

# Create non-root user first
RUN useradd -m -u 1000 user

# Set environment variables
ENV CONDA_DIR=/home/user/conda
ENV PATH=$CONDA_DIR/bin:$PATH
ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH

# Switch to user immediately
USER user
WORKDIR $HOME

# Install Miniconda in user's home directory
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
    /bin/bash ~/miniconda.sh -b -p $CONDA_DIR && \
    rm ~/miniconda.sh && \
    conda clean -a -y

# Create conda environment
RUN conda create -n yue python=3.8 -y
SHELL ["conda", "run", "-n", "yue", "/bin/bash", "-c"]

# Install PyTorch with CUDA support
RUN conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia -y

# Install flash-attention
RUN pip install flash-attn --no-build-isolation

# First clone repositories and create directories
WORKDIR $HOME/app

RUN git lfs install && \
    git clone --recursive https://github.com/multimodal-art-projection/YuE.git && \
    cd YuE && \
    git lfs pull && \
    cd inference && \
    git lfs checkout && \
    cd .. && \
    pip install -r requirements.txt
    
WORKDIR $HOME/app/YuE/inference
RUN git clone https://huggingface.co/m-a-p/xcodec_mini_infer

# Create output directory
RUN mkdir -p $HOME/app/output

# Copy only the necessary additional files
COPY --chown=user:user run.sh $HOME/app/
COPY --chown=user:user wrapper.py $HOME/app/YuE/inference/
RUN chmod +x $HOME/app/run.sh

# Set final working directory
WORKDIR $HOME/app

# ENTRYPOINT ["./run.sh"]