mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-04-22 15:32:08 +00:00
feat(neuron): add server standalone installation
This commit is contained in:
parent
9c25afb832
commit
337329fff3
@ -16,13 +16,15 @@ mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
|
|||||||
mkfile_dir := $(dir $(mkfile_path))
|
mkfile_dir := $(dir $(mkfile_path))
|
||||||
root_dir := "${mkfile_dir}/../.."
|
root_dir := "${mkfile_dir}/../.."
|
||||||
|
|
||||||
.PHONY: image
|
.PHONY: image install_server
|
||||||
|
|
||||||
VERSION := $(shell gawk 'match($$0, /^version = "(.*)"/, a) {print a[1]}' ${root_dir}/Cargo.toml)
|
VERSION := $(shell gawk 'match($$0, /^version = "(.*)"/, a) {print a[1]}' ${root_dir}/Cargo.toml)
|
||||||
|
|
||||||
image:
|
image:
|
||||||
docker build --rm -f ${root_dir}/Dockerfile.neuron \
|
docker build --rm -f ${root_dir}/Dockerfile.neuron \
|
||||||
--build-arg VERSION=$(VERSION) \
|
--build-arg VERSION=$(VERSION) \
|
||||||
--ulimit nofile=100000:100000 \
|
|
||||||
-t text-generation-inference:$(VERSION)-neuron ${root_dir}
|
-t text-generation-inference:$(VERSION)-neuron ${root_dir}
|
||||||
docker tag text-generation-inference:$(VERSION)-neuron text-generation-inference:latest-neuron
|
docker tag text-generation-inference:$(VERSION)-neuron text-generation-inference:latest-neuron
|
||||||
|
|
||||||
|
install_server:
|
||||||
|
make -C ${mkfile_dir}/server install VERSION:=${VERSION}
|
||||||
|
@ -1,15 +1,20 @@
|
|||||||
# Initialize base variables
|
# Initialize base variables
|
||||||
|
SHELL := /bin/bash
|
||||||
pkg_name := text_generation_server
|
pkg_name := text_generation_server
|
||||||
BUILDDIR ?= $(CURDIR)/build
|
BUILDDIR ?= $(CURDIR)/build
|
||||||
VERSION ?= 0.0.1
|
VERSION ?= 0.0.1
|
||||||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
|
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
mkfile_dir := $(dir $(mkfile_path))
|
mkfile_dir := $(dir $(mkfile_path))
|
||||||
pkg_dir := $(BUILDDIR)/$(pkg_name)
|
pkg_dir := $(BUILDDIR)/$(pkg_name)
|
||||||
pkg_dist := ${BUILDDIR}/dist/${pkg_name}-${VERSION}.tar.gz
|
py_version := $(subst -,.,${VERSION})
|
||||||
|
pkg_dist := ${BUILDDIR}/dist/${pkg_name}-$(py_version).tar.gz
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(BUILDDIR)/*
|
rm -rf $(BUILDDIR)/*
|
||||||
|
|
||||||
|
${BUILDDIR}:
|
||||||
|
install -d $@
|
||||||
|
|
||||||
# List static sources to be deployed in the package
|
# List static sources to be deployed in the package
|
||||||
src_dir := $(mkfile_dir)/$(pkg_name)
|
src_dir := $(mkfile_dir)/$(pkg_name)
|
||||||
sources := $(wildcard $(src_dir)/*.py)
|
sources := $(wildcard $(src_dir)/*.py)
|
||||||
@ -21,7 +26,15 @@ define COPY
|
|||||||
cp -f $< $@
|
cp -f $< $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(BUILDDIR)/pyproject.toml: $(mkfile_dir)/pyproject.toml
|
# We use a PHONY target to represent the VERSION
|
||||||
|
.PHONY: VERSION
|
||||||
|
|
||||||
|
VERSION: ${BUILDDIR}
|
||||||
|
# The trick is to compare the value of the variable with the content of a file in the build directory
|
||||||
|
@if [[ `cat ${BUILDDIR}/VERSION 2>&1` != '$(VERSION)' ]]; then echo -n $(VERSION) >${BUILDDIR}/VERSION; fi
|
||||||
|
|
||||||
|
# Depending on the PHONY VERSION target makes sure the pyproject.toml is regenerated if the version changes
|
||||||
|
$(BUILDDIR)/pyproject.toml: $(mkfile_dir)/pyproject.toml VERSION
|
||||||
mkdir -p $(BUILDDIR)
|
mkdir -p $(BUILDDIR)
|
||||||
$(COPY)
|
$(COPY)
|
||||||
sed -i -e 's/version = "VERSION"/version = \"${VERSION}\"/' $@
|
sed -i -e 's/version = "VERSION"/version = \"${VERSION}\"/' $@
|
||||||
@ -55,3 +68,7 @@ ${pkg_dist}: $(BUILDDIR)/pyproject.toml $(deployed_sources) $(generated_sources)
|
|||||||
python -m build $(BUILDDIR)
|
python -m build $(BUILDDIR)
|
||||||
|
|
||||||
package: ${pkg_dist}
|
package: ${pkg_dist}
|
||||||
|
|
||||||
|
install: ${pkg_dist}
|
||||||
|
python3 -m pip uninstall -y ${pkg_name}
|
||||||
|
python3 -m pip install ${pkg_dist}
|
||||||
|
@ -15,7 +15,8 @@ dependencies = [
|
|||||||
'grpc-interceptor == 0.15.2',
|
'grpc-interceptor == 0.15.2',
|
||||||
'typer == 0.6.1',
|
'typer == 0.6.1',
|
||||||
'safetensors',
|
'safetensors',
|
||||||
'loguru == 0.6.0'
|
'loguru == 0.6.0',
|
||||||
|
'optimum-neuron[neuronx] >= 0.0.28',
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.setuptools]
|
[tool.setuptools]
|
||||||
|
Loading…
Reference in New Issue
Block a user