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

Code completion with >=2 masks #305

Open
Requalvia opened this issue Dec 20, 2023 · 0 comments
Open

Code completion with >=2 masks #305

Requalvia opened this issue Dec 20, 2023 · 0 comments

Comments

@Requalvia
Copy link

Requalvia commented Dec 20, 2023

Hi.
I am using code completion task in UniXCoder, and I am wondering if it is possible to contain >=2 masks in one code.
For example:
`

context = """

  def write_json(data,file_path):
      data = json.<mask0>(data)
      with open(file_path, 'w') as f:
          <mask1>.write(data)
"""
tokens_ids = model.tokenize([context],max_length=512,mode="<encoder-decoder>")
source_ids = torch.tensor(tokens_ids).to(device)
prediction_ids = model.generate(source_ids, decoder_only=False, beam_size=3, max_length=128)
predictions = model.decode(prediction_ids)
print([x.replace("<mask0>","").strip() for x in predictions[0]])

`
But len(prediction) is 1, so is there a method to get the prediction of <mask1> ?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant