Spaces:
Runtime error
Runtime error
remove eos token
Browse files
app.py
CHANGED
@@ -19,10 +19,10 @@ FIM_SUFFIX = "<fim_suffix>"
|
|
19 |
|
20 |
FIM_INDICATOR = "<FILL_HERE>"
|
21 |
|
22 |
-
FORMATS = """## Model
|
23 |
|
24 |
-
The model is pretrained on code and is formatted with special tokens in addition to the pure code data
|
25 |
-
such as prefixes specifying the source of the file or tokens separating code from a commit message
|
26 |
Use these templates to explore the model's capacities:
|
27 |
|
28 |
### 1. Prefixes 🏷️
|
@@ -115,8 +115,11 @@ def generate(
|
|
115 |
|
116 |
previous_token = ""
|
117 |
for response in stream:
|
118 |
-
if
|
119 |
-
|
|
|
|
|
|
|
120 |
else:
|
121 |
output += response.token.text
|
122 |
previous_token = response.token.text
|
@@ -156,7 +159,7 @@ css += share_btn_css + monospace_css + custom_output_css + ".gradio-container {c
|
|
156 |
|
157 |
description = """
|
158 |
<div style="text-align: center;">
|
159 |
-
<h1 style='color: black;'> 💫 StarCoder<span style='color: #e6b800;'> - </span>Playground
|
160 |
<p style='color: black;'>This is a demo to generate code with <a href="https://huggingface.co/bigcode/starcoder" style='color: #e6b800;'>StarCoder</a>, a 15B parameter model for code generation in 86 programming languages.</p>
|
161 |
</div>
|
162 |
"""
|
@@ -238,4 +241,4 @@ with gr.Blocks(theme=theme, analytics_enabled=False, css=css) as demo:
|
|
238 |
outputs=[output],
|
239 |
)
|
240 |
share_button.click(None, [], [], _js=share_js)
|
241 |
-
demo.queue(concurrency_count=16).launch(debug=True)
|
|
|
19 |
|
20 |
FIM_INDICATOR = "<FILL_HERE>"
|
21 |
|
22 |
+
FORMATS = """## Model Formats
|
23 |
|
24 |
+
The model is pretrained on code and is formatted with special tokens in addition to the pure code data,\
|
25 |
+
such as prefixes specifying the source of the file or tokens separating code from a commit message.\
|
26 |
Use these templates to explore the model's capacities:
|
27 |
|
28 |
### 1. Prefixes 🏷️
|
|
|
115 |
|
116 |
previous_token = ""
|
117 |
for response in stream:
|
118 |
+
if response.token.text == "<|endoftext|>":
|
119 |
+
if fim_mode:
|
120 |
+
output += suffix
|
121 |
+
else:
|
122 |
+
return output
|
123 |
else:
|
124 |
output += response.token.text
|
125 |
previous_token = response.token.text
|
|
|
159 |
|
160 |
description = """
|
161 |
<div style="text-align: center;">
|
162 |
+
<h1 style='color: black;'> 💫 StarCoder<span style='color: #e6b800;'> - </span>Playground 🪐</h1>
|
163 |
<p style='color: black;'>This is a demo to generate code with <a href="https://huggingface.co/bigcode/starcoder" style='color: #e6b800;'>StarCoder</a>, a 15B parameter model for code generation in 86 programming languages.</p>
|
164 |
</div>
|
165 |
"""
|
|
|
241 |
outputs=[output],
|
242 |
)
|
243 |
share_button.click(None, [], [], _js=share_js)
|
244 |
+
demo.queue(concurrency_count=16).launch(debug=True)
|