Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,13 +4,13 @@ from transformers import pipeline
|
|
4 |
import os
|
5 |
import torch
|
6 |
|
7 |
-
description = """# <p style="text-align: center; color: white;"> ๐
<span style='color: #ff75b3;'>
|
8 |
<span style='color: white;'>This is a demo to generate code with <a href="https://huggingface.co/bigcode/santacoder" style="color: #ff75b3;">SantaCoder</a>,
|
9 |
a 1.1B parameter model for code generation in Python, Java & JavaScript. The model can also do infilling, just specify where you would like the model to complete code
|
10 |
with the <span style='color: #ff75b3;'><FILL-HERE></span> token.</span>"""
|
11 |
|
12 |
token = os.environ["HUB_TOKEN"]
|
13 |
-
device=
|
14 |
|
15 |
|
16 |
FIM_PREFIX = "<fim-prefix>"
|
@@ -21,7 +21,7 @@ EOD = "<|endoftext|>"
|
|
21 |
|
22 |
GENERATION_TITLE= "<p style='font-size: 16px; color: white;'>Generated code:</p>"
|
23 |
|
24 |
-
tokenizer_fim = AutoTokenizer.from_pretrained("
|
25 |
|
26 |
tokenizer_fim.add_special_tokens({
|
27 |
"additional_special_tokens": [EOD, FIM_PREFIX, FIM_MIDDLE, FIM_SUFFIX, FIM_PAD],
|
|
|
4 |
import os
|
5 |
import torch
|
6 |
|
7 |
+
description = """# <p style="text-align: center; color: white;"> ๐
<span style='color: #ff75b3;'>SantaFixer:</span> Code Generation </p>
|
8 |
<span style='color: white;'>This is a demo to generate code with <a href="https://huggingface.co/bigcode/santacoder" style="color: #ff75b3;">SantaCoder</a>,
|
9 |
a 1.1B parameter model for code generation in Python, Java & JavaScript. The model can also do infilling, just specify where you would like the model to complete code
|
10 |
with the <span style='color: #ff75b3;'><FILL-HERE></span> token.</span>"""
|
11 |
|
12 |
token = os.environ["HUB_TOKEN"]
|
13 |
+
device=torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
|
14 |
|
15 |
|
16 |
FIM_PREFIX = "<fim-prefix>"
|
|
|
21 |
|
22 |
GENERATION_TITLE= "<p style='font-size: 16px; color: white;'>Generated code:</p>"
|
23 |
|
24 |
+
tokenizer_fim = AutoTokenizer.from_pretrained("lambdasec/santafixer", use_auth_token=token, padding_side="left")
|
25 |
|
26 |
tokenizer_fim.add_special_tokens({
|
27 |
"additional_special_tokens": [EOD, FIM_PREFIX, FIM_MIDDLE, FIM_SUFFIX, FIM_PAD],
|