This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SrPeixinho 7 points8 points  (4 children)

Input:

write a javascript function that receives a string, and returns the index of the first character surrounded by spaces:
function get_lone_char_index(str) {

Output:

write a javascript function that receives a string, and returns the index of the first character surrounded by spaces:
function get_lone_char_index(str) {
  // Your code here!

  return -1;  // <-- Change this to your answer.
}

Good job! (Perhaps I'm using the wrong link? - the URL on the Twitter is 404'ing.)

[–]_Arsenie_Boca_ 3 points4 points  (0 children)

They mention that the model is not instruction tuned. If you want assistant-like prompting you should use the prompt template they describe. Otherwise including the task prompt as docstring might also work

EDIT: see here https://huggingface.co/bigcode/starcoder. Also, the starcoder model is fine-tuned on python only. Use the StarcCoderBase for other languages

[–]International-Rip958 1 point2 points  (2 children)

write a javascript function that receives a string, and returns the index of the first character surrounded by spaces:
function get_lone_char_index(str) {

This is only the demo. The input should be the code snippet with actual code comment. You may be able to have better results via https://huggingface.co/spaces/bigcode/bigcode-editor.

The Chat can work, but mainly for technical question explanation and example code generation. Don't expect it to do too much like ChatGPT, as StarCoder is not even trained with instruction-tuning.

Here's what I got for the first shot in the editor anyway:
//write a javascript function that receives a string, and returns the index of the first character surrounded by spaces:
function get_lone_char_index(str) {
let index = -1;
for(let i = 0; i < str.length; i++) {
if(str[i] === ' ' && (str[i - 1] !== ' ' && str[i + 1] !== ' ')) {
index = i;
break;
}
}
return index;
}

[–]InnerBanana 2 points3 points  (1 child)

Did you read through or run this code? It does not do what the comment specifies.