Spaces:
Running
Running
update
Browse files- .env.local.template +17 -23
- Dockerfile +21 -10
- README.md +3 -1
- entrypoint.sh.template +3 -7
.env.local.template
CHANGED
@@ -19,33 +19,27 @@ OPENID_SCOPES="openid profile" # Add "email" for some providers like Google that
|
|
19 |
OPENID_PROVIDER_URL=https://huggingface.co # for Google, use https://accounts.google.com
|
20 |
|
21 |
|
22 |
-
|
|
|
23 |
MODELS=`[
|
24 |
{
|
25 |
-
"name": "
|
26 |
-
"
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
],
|
40 |
-
"endpoints": [
|
41 |
-
{
|
42 |
-
"type": "tgi",
|
43 |
-
"url": "http://127.0.0.1:8080"
|
44 |
-
}
|
45 |
-
],
|
46 |
-
"parameters": ${MODEL_PARAMS}
|
47 |
}
|
48 |
]`
|
|
|
49 |
OLD_MODELS=`[]`# any removed models, `{ name: string, displayName?: string, id?: string }`
|
50 |
|
51 |
PUBLIC_ORIGIN=${SPACE_HOST}
|
|
|
19 |
OPENID_PROVIDER_URL=https://huggingface.co # for Google, use https://accounts.google.com
|
20 |
|
21 |
|
22 |
+
OPENAI_API_KEY=${OPENAI_API_KEY}
|
23 |
+
|
24 |
MODELS=`[
|
25 |
{
|
26 |
+
"name": "yi-34b-chat-0205",
|
27 |
+
"parameters": {
|
28 |
+
"temperature": 0.3,
|
29 |
+
"top_p": 0.8,
|
30 |
+
"repetition_penalty": 0.0,
|
31 |
+
"max_tokens": 1024,
|
32 |
+
"top_k": 50,
|
33 |
+
"truncate": 1000,
|
34 |
+
"max_new_tokens": 1024
|
35 |
+
},
|
36 |
+
"endpoints": [{
|
37 |
+
"type" : "openai",
|
38 |
+
"baseURL": "${ENDPOINT}"
|
39 |
+
}]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
]`
|
42 |
+
|
43 |
OLD_MODELS=`[]`# any removed models, `{ name: string, displayName?: string, id?: string }`
|
44 |
|
45 |
PUBLIC_ORIGIN=${SPACE_HOST}
|
Dockerfile
CHANGED
@@ -19,7 +19,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
|
|
19 |
rm -rf /var/lib/apt/lists/*
|
20 |
|
21 |
|
22 |
-
RUN git clone https://github.com/huggingface/chat-ui.git
|
23 |
|
24 |
WORKDIR /app/chat-ui
|
25 |
|
@@ -29,16 +29,27 @@ COPY .env.local.template .env.local.template
|
|
29 |
RUN mkdir defaults
|
30 |
ADD defaults /defaults
|
31 |
RUN chmod -R 777 /defaults
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
RUN --mount=type=secret,id=MONGODB_URL,mode=0444 \
|
33 |
MODEL_NAME="${MODEL_NAME:="$(cat /defaults/MODEL_NAME)"}" && export MODEL_NAME \
|
34 |
&& MODEL_PARAMS="${MODEL_PARAMS:="$(cat /defaults/MODEL_PARAMS)"}" && export MODEL_PARAMS \
|
35 |
&& MODEL_PROMPT_TEMPLATE="${MODEL_PROMPT_TEMPLATE:="$(cat /defaults/MODEL_PROMPT_TEMPLATE)"}" && export MODEL_PROMPT_TEMPLATE \
|
36 |
&& APP_COLOR="${APP_COLOR:="$(cat /defaults/APP_COLOR)"}" && export APP_COLOR \
|
37 |
&& APP_NAME="${APP_NAME:="$(cat /defaults/APP_NAME)"}" && export APP_NAME \
|
38 |
-
&& MONGODB_URL=$(cat /run/secrets/MONGODB_URL
|
39 |
-
echo "${MONGODB_URL}" && \
|
40 |
-
|
41 |
-
&&
|
|
|
42 |
|
43 |
|
44 |
|
@@ -83,11 +94,11 @@ RUN --mount=type=secret,id=MONGODB_URL,mode=0444 \
|
|
83 |
&& rm entrypoint.sh.template
|
84 |
|
85 |
|
86 |
-
RUN curl -fsSL https://
|
87 |
-
gpg -o /usr/share/keyrings/mongodb-server-
|
88 |
-
|
89 |
|
90 |
-
RUN echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-
|
91 |
|
92 |
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
93 |
mongodb-org && \
|
@@ -96,7 +107,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
|
|
96 |
RUN mkdir -p /data/db
|
97 |
RUN chown -R 1000:1000 /data
|
98 |
|
99 |
-
RUN curl -fsSL https://deb.nodesource.com/
|
100 |
|
101 |
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
102 |
nodejs && \
|
|
|
19 |
rm -rf /var/lib/apt/lists/*
|
20 |
|
21 |
|
22 |
+
RUN git clone -b v0.7 https://github.com/huggingface/chat-ui.git
|
23 |
|
24 |
WORKDIR /app/chat-ui
|
25 |
|
|
|
29 |
RUN mkdir defaults
|
30 |
ADD defaults /defaults
|
31 |
RUN chmod -R 777 /defaults
|
32 |
+
|
33 |
+
|
34 |
+
RUN --mount=type=secret,id=OPENAI_API_KEY,mode=0444 \
|
35 |
+
OPENAI_API_KEY=$(cat /run/secrets/OPENAI_API_KEY) && export OPENAI_API_KEY && echo "${OPENAI_API_KEY}" >> "/defaults/.openai.key" && cat /defaults/.openai.key
|
36 |
+
|
37 |
+
|
38 |
+
RUN --mount=type=secret,id=ENDPOINT,mode=0444 \
|
39 |
+
ENDPOINT=$(cat /run/secrets/ENDPOINT) && export ENDPOINT && echo "${ENDPOINT}" >> "/defaults/.endpoint" && cat /defaults/.endpoint
|
40 |
+
|
41 |
+
|
42 |
RUN --mount=type=secret,id=MONGODB_URL,mode=0444 \
|
43 |
MODEL_NAME="${MODEL_NAME:="$(cat /defaults/MODEL_NAME)"}" && export MODEL_NAME \
|
44 |
&& MODEL_PARAMS="${MODEL_PARAMS:="$(cat /defaults/MODEL_PARAMS)"}" && export MODEL_PARAMS \
|
45 |
&& MODEL_PROMPT_TEMPLATE="${MODEL_PROMPT_TEMPLATE:="$(cat /defaults/MODEL_PROMPT_TEMPLATE)"}" && export MODEL_PROMPT_TEMPLATE \
|
46 |
&& APP_COLOR="${APP_COLOR:="$(cat /defaults/APP_COLOR)"}" && export APP_COLOR \
|
47 |
&& APP_NAME="${APP_NAME:="$(cat /defaults/APP_NAME)"}" && export APP_NAME \
|
48 |
+
&& MONGODB_URL=$(cat /run/secrets/MONGODB_URL || cat /defaults/MONGODB_URL) && export MONGODB_URL && \
|
49 |
+
echo "${MONGODB_URL}" && OPENAI_API_KEY=$(cat /defaults/.openai.key) && export OPENAI_API_KEY && echo "${OPENAI_API_KEY}" \
|
50 |
+
&& ENDPOINT=$(cat /defaults/.endpoint) && export ENDPOINT && echo "${ENDPOINT}" \
|
51 |
+
&& envsubst < ".env.local.template" > ".env.local" \
|
52 |
+
&& rm .env.local.template && cat .env.local
|
53 |
|
54 |
|
55 |
|
|
|
94 |
&& rm entrypoint.sh.template
|
95 |
|
96 |
|
97 |
+
RUN curl -fsSL https://pgp.mongodb.com/server-6.0.asc | \
|
98 |
+
gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg \
|
99 |
+
--dearmor
|
100 |
|
101 |
+
RUN echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
|
102 |
|
103 |
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
104 |
mongodb-org && \
|
|
|
107 |
RUN mkdir -p /data/db
|
108 |
RUN chown -R 1000:1000 /data
|
109 |
|
110 |
+
RUN curl -fsSL https://deb.nodesource.com/setup_19.x | /bin/bash -
|
111 |
|
112 |
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
113 |
nodejs && \
|
README.md
CHANGED
@@ -2,12 +2,14 @@
|
|
2 |
title: Yi 1.5 34B Chat
|
3 |
emoji: π
|
4 |
colorFrom: indigo
|
5 |
-
colorTo:
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
app_port: 3000
|
9 |
suggested_hardware: a10g-small
|
10 |
license: apache-2.0
|
|
|
|
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
2 |
title: Yi 1.5 34B Chat
|
3 |
emoji: π
|
4 |
colorFrom: indigo
|
5 |
+
colorTo: purple
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
app_port: 3000
|
9 |
suggested_hardware: a10g-small
|
10 |
license: apache-2.0
|
11 |
+
models:
|
12 |
+
- 01-ai/Yi-1.5-34B-Chat
|
13 |
---
|
14 |
|
15 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
entrypoint.sh.template
CHANGED
@@ -1,17 +1,13 @@
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
-
# Make sure `/data/db` directory exists even with persistent storage
|
4 |
-
mkdir -p /data/db
|
5 |
-
# If app crashed, mongo didn't stop gracefully. Remove all the old *.lock files
|
6 |
-
find /data/db -name "*.lock" -type f -exec rm -f {} \;
|
7 |
# Start the local Mongo database
|
8 |
-
mongod &
|
9 |
|
10 |
# Start the text-generation-inference process
|
11 |
-
text-generation-launcher --model-id ${MODEL_NAME} --num-shard 1 --port 8080 --trust-remote-code &
|
12 |
|
13 |
# Wait for text-generation-inference to start
|
14 |
-
curl --retry 60 --retry-delay 10 --retry-connrefused http://127.0.0.1:8080/health
|
15 |
|
16 |
# Start the chat-ui process
|
17 |
pm2 start /app/build/index.js -i $CPU_CORES --no-daemon &
|
|
|
1 |
#!/bin/bash
|
2 |
|
|
|
|
|
|
|
|
|
3 |
# Start the local Mongo database
|
4 |
+
#mongod &
|
5 |
|
6 |
# Start the text-generation-inference process
|
7 |
+
#text-generation-launcher --model-id ${MODEL_NAME} --num-shard 1 --port 8080 --trust-remote-code &
|
8 |
|
9 |
# Wait for text-generation-inference to start
|
10 |
+
#curl --retry 60 --retry-delay 10 --retry-connrefused http://127.0.0.1:8080/health
|
11 |
|
12 |
# Start the chat-ui process
|
13 |
pm2 start /app/build/index.js -i $CPU_CORES --no-daemon &
|