Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIM return escaping symbols #1655

Open
3 tasks done
Semihal opened this issue Jul 3, 2024 · 6 comments
Open
3 tasks done

FIM return escaping symbols #1655

Semihal opened this issue Jul 3, 2024 · 6 comments
Labels
area:autocomplete Relates to the auto complete feature ide:vscode Relates specifically to VS Code extension kind:bug Indicates an unexpected problem or unintended behavior

Comments

@Semihal
Copy link

Semihal commented Jul 3, 2024

Before submitting your bug report

Relevant environment info

- OS: MacOS 14.5
- Continue: v0.8.42
- IDE: VSCode 1.90.2
- Model: vLLM (CodeQwen1.5-7B) -> LiteLLM
- config.json:
  
{
  "tabAutocompleteModel": {
    "title": "Autocomplete model",
    "provider": "openai",
    "apiBase": "<endpoint>",
    "apiKey": "<token>",
    "model": "qwen",
    "useLegacyCompletionsEndpoint": true,
    "requestOptions": {
      "verifySsl": false
    }
  },
  "tabAutocompleteOptions":{
    "useSuffix": false,
    "useCache": false,
    "template": "<fim_prefix>{{ prefix }}<fim_suffix>{{ suffix }}<fim_middle> "
  },
  "allowAnonymousTelemetry": false
}

Description

I had broken autocomplete:
image

The same model with the CodeGPT plugin for JetBrainns is working properly :(

To reproduce

No response

Log output

No response

@Semihal Semihal added the bug label Jul 3, 2024
@sestinj
Copy link
Contributor

sestinj commented Jul 3, 2024

@Semihal can you share what you see in the prompt logs? This would help us know whether the model is sending these escaped characters or not

@Semihal
Copy link
Author

Semihal commented Jul 4, 2024

@Semihal can you share what you see in the prompt logs? This would help us know whether the model is sending these escaped characters or not

==========================================================================
Settings:
contextLength: 4096
model: qwen-fim
maxTokens: 1024
temperature: 0.01
raw: true
stop: 

,

,/src/,#- coding: utf-8,```,
def,
class,
"""#
log: undefined

############################################

<fim_prefix>    for x in snake_list:
        pygame.draw.rect(dis, black, [x[0], x[1], snake_block, snake_block])

def gameLoop():
    game_over &#x3D; False
    game_close &#x3D; False

    x1 &#x3D; dis_width / 2
    y1 &#x3D; dis_height / 2

    x1_change &#x3D; 0
    y1_change &#x3D; 0

    snake_list &#x3D; []
    Length_of_snake &#x3D; 1

    foodx &#x3D; round(random.randrange(0, dis_width - snake_block) / 10.0) * 10.0
    foody &#x3D; round(random.randrange(0, dis_height - snake_block) / 10.0) * 10.0

    while not game_over:

        while game_close &#x3D;&#x3D; True:
            dis.fill(blue)
            message(&quot;Игра окончена. Q-Выход, C-Продолжить&quot;, red)
            pygame.display.update()

            for event in pygame.event.get():
                if event.type &#x3D;&#x3D; pygame.KEYDOWN:
                    if event.key &#x3D;&#x3D; pygame.K_q:
                        game_over &#x3D; True
                        game_close &#x3D; False
                    if event.key &#x3D;&#x3D; pygame.K_c:
                        gameLoop()

        for event in pygame.event.get():
            if event.type &#x3D;&#x3D; pygame.QUIT:
                game_over &#x3D; True
                game_close &#x3D; False
            if event.type &#x3D;&#x3D; pygame.KEYDOWN:
                if event.key &#x3D;&#x3D; pygame.K_UP:
                    y1_change &#x3D; -snake_block
                    x1_change &#x3D; 0
                elif event.key &#x3D;&#x3D; pygame.K_DOWN:
                    y1_change &#x3D; snake_block
                    x1_change &#x3D; 0
                elif event.key &#x3D;&#x3D; pygame.K_LEFT:
                    x1_change &#x3D; -snake_block
                    y1_change &#x3D; 0
                elif event.key &#x3D;&#x3D; pygame.K_RIGHT:
                    x1_change &#x3D; snake_block
                    y1_change &#x3D; 0

        if x1 &gt;&#x3D; dis_width or x1 &lt; 0 or y1 &gt;&#x3D; dis_height or y1 &lt; 0:
            game_close &#x3D; True
        x1 +&#x3D; x1_change
        y1 +&#x3D; y1_change
        dis.fill(blue)
        pygame.draw.rect(dis, green, [foodx, foody, snake_block, snake_block])
        snake_Head &#x3D; []
        snake_Head.append(x1)
        snake_Head.append(y1)
        snake_list.append(snake_Head)
        if len(snake_list) &gt; Length_of_snake:
            del snake_list[0]

        for x in snake_list[:-1]:
            if x &#x3D;&#x3D; snake_Head:
                game_close &#x3D; True

        our_snake(snake_block, snake_list)

        pygame.display.update()

        if x1 &#x3D;&#x3D; foodx and y1 &#x3D;&#x3D; foody:
            foodx &#x3D; round(random.randrange(0, dis_width - snake_block) / 10.0) * 10.0
            foody &#x3D; round(random.randrange(0, dis_height - snake_block) / 10.0) * 10.0
            Length_of_snake +&#x3D; 1
        
        if <fim_suffix>

        clock.tick(snake_speed)

    pygame.quit()
    quit()<fim_middle> ==========================================================================
==========================================================================
Completion:

0 &lt;= x1 &lt; dis_width and 0 &lt;= y1 &lt; dis_height:
            pygame.draw.rect(dis, black, [x1, y1, snake_block, snake_block])
        else:
            game_close &#x3D; True

As I understand it, there is excessive shielding, to which LM responds in the same way?

@sestinj
Copy link
Contributor

sestinj commented Jul 4, 2024

@Semihal is it safe to assume that your code doesn't actually look like &#x3D and that these should all be =? It looks like the language model is just responding to match the escape pattern that it sees above, so the problem is actually in the prompt

@Semihal
Copy link
Author

Semihal commented Jul 4, 2024

@Semihal is it safe to assume that your code doesn't actually look like &#x3D and that these should all be =? It looks like the language model is just responding to match the escape pattern that it sees above, so the problem is actually in the prompt

I have the code without any escaping. The screenshot in the original message shows an example (there is no escaping). Apparently, the plugin is running a data transfer escape and LLM is trying to match it. Can we make some additional parameter in config.json to disable the escaping?

@Semihal
Copy link
Author

Semihal commented Jul 8, 2024

I noticed that the escaping is applied only when specifying a template (in config.json)... Everything works well without it. Is it possible to make a setting to disable the escaping?

@dosubot dosubot bot added area:autocomplete Relates to the auto complete feature kind:bug Indicates an unexpected problem or unintended behavior ide:vscode Relates specifically to VS Code extension and removed bug labels Jul 8, 2024
@sestinj
Copy link
Contributor

sestinj commented Jul 8, 2024

Oh ok thank you for pointing this out. The escaping isn't intentional, but since it's only happening with templates, I'm almost certain that Handlebars is doing the escaping. This is a good starting point for me to debug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:autocomplete Relates to the auto complete feature ide:vscode Relates specifically to VS Code extension kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants