mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-06-05 17:02:08 +00:00
fix: feature flag video and remove from non cuda dockerfiles
This commit is contained in:
parent
5322abd9f5
commit
b4da6ad30e
@ -54,7 +54,7 @@ COPY benchmark benchmark
|
|||||||
COPY router router
|
COPY router router
|
||||||
COPY backends backends
|
COPY backends backends
|
||||||
COPY launcher launcher
|
COPY launcher launcher
|
||||||
RUN cargo build --profile release-opt --frozen
|
RUN cargo build --profile release-opt --frozen --features video
|
||||||
|
|
||||||
# Python builder
|
# Python builder
|
||||||
# Adapted from: https://github.com/pytorch/pytorch/blob/master/Dockerfile
|
# Adapted from: https://github.com/pytorch/pytorch/blob/master/Dockerfile
|
||||||
|
@ -18,18 +18,7 @@ RUN cargo chef prepare --recipe-path recipe.json
|
|||||||
FROM chef AS builder
|
FROM chef AS builder
|
||||||
|
|
||||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||||
python3.11-dev \
|
python3.11-dev
|
||||||
ffmpeg \
|
|
||||||
libavcodec-dev \
|
|
||||||
libavfilter-dev \
|
|
||||||
libavdevice-dev \
|
|
||||||
libavformat-dev \
|
|
||||||
libavutil-dev \
|
|
||||||
libswscale-dev \
|
|
||||||
pkg-config \
|
|
||||||
libclang-dev \
|
|
||||||
clang
|
|
||||||
|
|
||||||
RUN PROTOC_ZIP=protoc-21.12-linux-x86_64.zip && \
|
RUN PROTOC_ZIP=protoc-21.12-linux-x86_64.zip && \
|
||||||
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.12/$PROTOC_ZIP && \
|
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.12/$PROTOC_ZIP && \
|
||||||
unzip -o $PROTOC_ZIP -d /usr/local bin/protoc && \
|
unzip -o $PROTOC_ZIP -d /usr/local bin/protoc && \
|
||||||
@ -330,10 +319,6 @@ COPY --from=builder /usr/src/target/release-opt/text-generation-router /usr/loca
|
|||||||
COPY --from=builder /usr/src/target/release-opt/text-generation-launcher /usr/local/bin/text-generation-launcher
|
COPY --from=builder /usr/src/target/release-opt/text-generation-launcher /usr/local/bin/text-generation-launcher
|
||||||
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/conda/lib/"
|
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/conda/lib/"
|
||||||
|
|
||||||
# Copy the ffmpeg libraries
|
|
||||||
COPY --from=builder /usr/lib/x86_64-linux-gnu/* /usr/lib/x86_64-linux-gnu-copy/
|
|
||||||
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu-copy"
|
|
||||||
|
|
||||||
# AWS Sagemaker compatible image
|
# AWS Sagemaker compatible image
|
||||||
FROM base AS sagemaker
|
FROM base AS sagemaker
|
||||||
|
|
||||||
|
@ -19,18 +19,7 @@ RUN cargo chef prepare --recipe-path recipe.json
|
|||||||
FROM chef AS builder
|
FROM chef AS builder
|
||||||
|
|
||||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||||
python3.11-dev \
|
python3.11-dev
|
||||||
ffmpeg \
|
|
||||||
libavcodec-dev \
|
|
||||||
libavfilter-dev \
|
|
||||||
libavdevice-dev \
|
|
||||||
libavformat-dev \
|
|
||||||
libavutil-dev \
|
|
||||||
libswscale-dev \
|
|
||||||
pkg-config \
|
|
||||||
libclang-dev \
|
|
||||||
clang
|
|
||||||
|
|
||||||
RUN PROTOC_ZIP=protoc-21.12-linux-x86_64.zip && \
|
RUN PROTOC_ZIP=protoc-21.12-linux-x86_64.zip && \
|
||||||
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.12/$PROTOC_ZIP && \
|
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.12/$PROTOC_ZIP && \
|
||||||
unzip -o $PROTOC_ZIP -d /usr/local bin/protoc && \
|
unzip -o $PROTOC_ZIP -d /usr/local bin/protoc && \
|
||||||
@ -232,10 +221,6 @@ COPY --from=builder /usr/src/target/release-opt/text-generation-router /usr/loca
|
|||||||
# Install launcher
|
# Install launcher
|
||||||
COPY --from=builder /usr/src/target/release-opt/text-generation-launcher /usr/local/bin/text-generation-launcher
|
COPY --from=builder /usr/src/target/release-opt/text-generation-launcher /usr/local/bin/text-generation-launcher
|
||||||
|
|
||||||
# Copy the ffmpeg libraries
|
|
||||||
COPY --from=builder /usr/lib/x86_64-linux-gnu/* /usr/lib/x86_64-linux-gnu-copy/
|
|
||||||
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu-copy"
|
|
||||||
|
|
||||||
FROM ${PLATFORM} AS final
|
FROM ${PLATFORM} AS final
|
||||||
ENV ATTENTION=paged
|
ENV ATTENTION=paged
|
||||||
ENV PREFIX_CACHING=0
|
ENV PREFIX_CACHING=0
|
||||||
|
@ -25,13 +25,6 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|||||||
libssl-dev \
|
libssl-dev \
|
||||||
libucx-dev \
|
libucx-dev \
|
||||||
ninja-build \
|
ninja-build \
|
||||||
ffmpeg \
|
|
||||||
libavcodec-dev \
|
|
||||||
libavfilter-dev \
|
|
||||||
libavdevice-dev \
|
|
||||||
libavformat-dev \
|
|
||||||
libavutil-dev \
|
|
||||||
libswscale-dev \
|
|
||||||
pkg-config \
|
pkg-config \
|
||||||
pipx \
|
pipx \
|
||||||
python3 \
|
python3 \
|
||||||
@ -110,9 +103,6 @@ COPY --from=mpi-builder /usr/local/mpi /usr/local/mpi
|
|||||||
COPY --from=trt-builder /usr/local/tensorrt /usr/local/tensorrt
|
COPY --from=trt-builder /usr/local/tensorrt /usr/local/tensorrt
|
||||||
COPY --from=tgi-builder /usr/local/tgi /usr/local/tgi
|
COPY --from=tgi-builder /usr/local/tgi /usr/local/tgi
|
||||||
COPY --from=tgi-builder /usr/src/text-generation-inference/target/release/text-generation-backends-trtllm /usr/local/tgi/bin/text-generation-launcher
|
COPY --from=tgi-builder /usr/src/text-generation-inference/target/release/text-generation-backends-trtllm /usr/local/tgi/bin/text-generation-launcher
|
||||||
# Copy the ffmpeg libraries
|
|
||||||
COPY --from=cuda-builder /usr/lib/x86_64-linux-gnu/* /usr/lib/x86_64-linux-gnu-copy/
|
|
||||||
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu-copy"
|
|
||||||
|
|
||||||
FROM runtime
|
FROM runtime
|
||||||
|
|
||||||
|
@ -77,3 +77,4 @@ default = ["ngrok"]
|
|||||||
ngrok = ["dep:ngrok"]
|
ngrok = ["dep:ngrok"]
|
||||||
google = []
|
google = []
|
||||||
kserve = []
|
kserve = []
|
||||||
|
video = []
|
||||||
|
@ -22,9 +22,14 @@ use tokio::sync::oneshot;
|
|||||||
use tracing::{instrument, Span};
|
use tracing::{instrument, Span};
|
||||||
use {once_cell::sync::Lazy, regex::Regex};
|
use {once_cell::sync::Lazy, regex::Regex};
|
||||||
// video processing
|
// video processing
|
||||||
use ffmpeg_next::format::Pixel;
|
|
||||||
use ffmpeg_next::media::Type;
|
#[cfg(feature = "video")]
|
||||||
use ffmpeg_next::software::scaling::{context::Context, flag::Flags};
|
use ffmpeg_next::{
|
||||||
|
format::Pixel,
|
||||||
|
media::Type,
|
||||||
|
software::scaling::{context::Context, flag::Flags},
|
||||||
|
};
|
||||||
|
#[cfg(feature = "video")]
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
||||||
static DEFAULT_GENERATION_LENGTH: u32 = 1024;
|
static DEFAULT_GENERATION_LENGTH: u32 = 1024;
|
||||||
@ -541,6 +546,16 @@ fn format_to_mimetype(format: ImageFormat) -> String {
|
|||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "video"))]
|
||||||
|
pub fn fetch_video(
|
||||||
|
_input: &str,
|
||||||
|
_target_width: u32,
|
||||||
|
_target_height: u32,
|
||||||
|
) -> Result<ProcessedVideo, ValidationError> {
|
||||||
|
Err(ValidationError::VideoNotSupported)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "video")]
|
||||||
pub fn fetch_video(
|
pub fn fetch_video(
|
||||||
input: &str,
|
input: &str,
|
||||||
target_width: u32,
|
target_width: u32,
|
||||||
@ -1091,6 +1106,8 @@ pub enum ValidationError {
|
|||||||
IoError(#[from] std::io::Error),
|
IoError(#[from] std::io::Error),
|
||||||
#[error("ffmpeg error")]
|
#[error("ffmpeg error")]
|
||||||
FFmpegError,
|
FFmpegError,
|
||||||
|
#[error("video not supported")]
|
||||||
|
VideoNotSupported,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Loading…
Reference in New Issue
Block a user