Cnass commited on
Commit
7c6bd51
·
verified ·
1 Parent(s): 4112c61

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -1
Dockerfile CHANGED
@@ -89,7 +89,31 @@ RUN pip install --no-cache-dir -r requirements.txt
89
 
90
  COPY app ./app
91
  COPY test-ui ./test-ui
92
- COPY entrypoint.sh chat-template-rosetta.jinja ./
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  # --version is a real build-time smoke test: it fails the build if the binary
94
  # cannot start (e.g. a missing shared library), instead of letting the Space
95
  # deploy and only then crash on first request.
 
89
 
90
  COPY app ./app
91
  COPY test-ui ./test-ui
92
+ COPY entrypoint.sh ./
93
+
94
+ # Written inline rather than COPYed from chat-template-rosetta.jinja in the
95
+ # repo (kept there too, as a readable reference) so the build can't fail with
96
+ # "not found" just because that one extra file didn't make it into whatever
97
+ # upload/sync produced the build context - which is exactly what happened
98
+ # deploying this the first time. Content must stay identical to the repo
99
+ # copy; see the comment there for why this template exists at all.
100
+ RUN cat <<'CHAT_TEMPLATE' > /app/chat-template-rosetta.jinja
101
+ {{- bos_token -}}
102
+ {%- for m in messages -%}
103
+ {%- if m['role'] == 'system' -%}
104
+ {{- '<start_of_turn>instruction\n' -}}{{- m['content'] | trim -}}{{- '<end_of_turn>\n' -}}
105
+ {%- endif -%}
106
+ {%- endfor -%}
107
+ {%- for m in messages -%}
108
+ {%- if m['role'] == 'user' -%}
109
+ {{- '<start_of_turn>source\n' -}}{{- m['content'] | trim -}}{{- '<end_of_turn>\n' -}}
110
+ {%- endif -%}
111
+ {%- endfor -%}
112
+ {%- if add_generation_prompt -%}
113
+ {{- '<start_of_turn>translation\n' -}}
114
+ {%- endif -%}
115
+ CHAT_TEMPLATE
116
+
117
  # --version is a real build-time smoke test: it fails the build if the binary
118
  # cannot start (e.g. a missing shared library), instead of letting the Space
119
  # deploy and only then crash on first request.