Update app.py
Browse files
app.py
CHANGED
|
@@ -11,13 +11,13 @@ from share_btn import community_icon_html, loading_icon_html, share_js, share_bt
|
|
| 11 |
|
| 12 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 13 |
|
| 14 |
-
API_URL = "https://api-inference.huggingface.co/models/codellama/CodeLlama-
|
| 15 |
|
| 16 |
FIM_PREFIX = "<PRE> "
|
| 17 |
FIM_MIDDLE = " <MID>"
|
| 18 |
FIM_SUFFIX = "<SUF>"
|
| 19 |
|
| 20 |
-
FIM_INDICATOR = "<
|
| 21 |
|
| 22 |
EOS_STRING = "</s>"
|
| 23 |
EOT_STRING = "<EOT>"
|
|
@@ -82,8 +82,7 @@ def generate(
|
|
| 82 |
if any([end_token in response.token.text for end_token in [EOS_STRING, EOT_STRING]]):
|
| 83 |
if fim_mode:
|
| 84 |
output += suffix
|
| 85 |
-
|
| 86 |
-
return output
|
| 87 |
else:
|
| 88 |
output += response.token.text
|
| 89 |
previous_token = response.token.text
|
|
@@ -96,6 +95,7 @@ examples = [
|
|
| 96 |
"// Returns every other value in the array as a new array.\nfunction everyOther(arr) {",
|
| 97 |
"Poor English: She no went to the market. Corrected English:",
|
| 98 |
"def alternating(list1, list2):\n results = []\n for i in range(min(len(list1), len(list2))):\n results.append(list1[i])\n results.append(list2[i])\n if len(list1) > len(list2):\n <FILL_HERE>\n else:\n results.extend(list2[i+1:])\n return results",
|
|
|
|
| 99 |
]
|
| 100 |
|
| 101 |
|
|
|
|
| 11 |
|
| 12 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 13 |
|
| 14 |
+
API_URL = "https://api-inference.huggingface.co/models/codellama/CodeLlama-13b-hf"
|
| 15 |
|
| 16 |
FIM_PREFIX = "<PRE> "
|
| 17 |
FIM_MIDDLE = " <MID>"
|
| 18 |
FIM_SUFFIX = "<SUF>"
|
| 19 |
|
| 20 |
+
FIM_INDICATOR = "<FILL_ME>"
|
| 21 |
|
| 22 |
EOS_STRING = "</s>"
|
| 23 |
EOT_STRING = "<EOT>"
|
|
|
|
| 82 |
if any([end_token in response.token.text for end_token in [EOS_STRING, EOT_STRING]]):
|
| 83 |
if fim_mode:
|
| 84 |
output += suffix
|
| 85 |
+
return output
|
|
|
|
| 86 |
else:
|
| 87 |
output += response.token.text
|
| 88 |
previous_token = response.token.text
|
|
|
|
| 95 |
"// Returns every other value in the array as a new array.\nfunction everyOther(arr) {",
|
| 96 |
"Poor English: She no went to the market. Corrected English:",
|
| 97 |
"def alternating(list1, list2):\n results = []\n for i in range(min(len(list1), len(list2))):\n results.append(list1[i])\n results.append(list2[i])\n if len(list1) > len(list2):\n <FILL_HERE>\n else:\n results.extend(list2[i+1:])\n return results",
|
| 98 |
+
"def remove_non_ascii(s: str) -> str:\n \"\"\" <FILL_ME>\n return result",
|
| 99 |
]
|
| 100 |
|
| 101 |
|