Views
No views yet
1git clone https://github.com/foundation-model-stack/fms-extras
2cd fms-extras
3pip install -e .1HF_HUB_CACHE=/hf_hub_cache
2chmod a+w $HF_HUB_CACHE
3HF_HUB_TOKEN="your huggingface hub token"
4TGIS_IMAGE=quay.io/wxpe/text-gen-server:main.ddc56ee
5
6docker pull $TGIS_IMAGE
7
8# optionally download granite-3b-code-instruct if the weights do not already exist
9docker run --rm \
10 -v $HF_HUB_CACHE:/models \
11 -e HF_HUB_CACHE=/models \
12 -e TRANSFORMERS_CACHE=/models \
13 $TGIS_IMAGE \
14 text-generation-server download-weights \
15 ibm-granite/granite-3b-code-instruct \
16 --token $HF_HUB_TOKEN
17
18# optionally download the speculator model if the weights do not already exist
19docker run --rm \
20 -v $HF_HUB_CACHE:/models \
21 -e HF_HUB_CACHE=/models \
22 -e TRANSFORMERS_CACHE=/models \
23 $TGIS_IMAGE \
24 text-generation-server download-weights \
25 ibm-granite/granite-3b-code-instruct-accelerator \
26 --token $HF_HUB_TOKEN
27
28# note: if the weights were downloaded separately (not with the above commands), please place them in the HF_HUB_CACHE directory and refer to them with /models/<model_name>
29docker run -d --rm --gpus all \
30 --name my-tgis-server \
31 -p 8033:8033 \
32 -v $HF_HUB_CACHE:/models \
33 -e HF_HUB_CACHE=/models \
34 -e TRANSFORMERS_CACHE=/models \
35 -e MODEL_NAME=ibm-granite/granite-3b-code-instruct \
36 -e SPECULATOR_NAME=ibm-granite/granite-3b-code-instruct-accelerator \
37 -e FLASH_ATTENTION=true \
38 -e PAGED_ATTENTION=true \
39 -e DTYPE=float16 \
40 $TGIS_IMAGE
41
42# check logs and wait for "gRPC server started on port 8033" and "HTTP server started on port 3000"
43docker logs my-tgis-server -f
44
45# get the client sample (Note: The first prompt will take longer as there is a warmup time)
46conda create -n tgis-client-env python=3.11
47conda activate tgis-client-env
48git clone --branch main --single-branch https://github.com/IBM/text-generation-inference.git
49cd text-generation-inference/integration_tests
50make gen-client
51pip install . --no-cache-dirpython sample_client.py1model=ibm-granite/granite-3b-code-instruct-accelerator
2volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
3docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:latest --model-id $model1curl 127.0.0.1:8080/generate_stream \
2 -X POST \
3 -d '{"inputs":"Write a bubble sort in python","parameters":{"max_new_tokens":100}}' \
4 -H 'Content-Type: application/json'