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

Recreating the performance from the README's gif? #16

Closed
kiwih opened this issue Nov 19, 2021 · 2 comments
Closed

Recreating the performance from the README's gif? #16

kiwih opened this issue Nov 19, 2021 · 2 comments

Comments

@kiwih
Copy link

kiwih commented Nov 19, 2021

Hi there, I am trying to recreate the suggestion from the gif in the README. Using the suggested code in the README, I have the following:

from transformers import RobertaTokenizer, T5ForConditionalGeneration
import os

tokenizer = RobertaTokenizer.from_pretrained("Salesforce/codet5-base")
model = T5ForConditionalGeneration.from_pretrained('Salesforce/codet5-base')

text = """
// convert from one currency to another
"""

input_ids = tokenizer(text, return_tensors="pt").input_ids

# simply generate one code span
generated_ids = model.generate(input_ids, max_length=256)
print(tokenizer.decode(generated_ids[0], skip_special_tokens=True))

However this does not generate the suggested code, it only gets as far as "public static".
What am I doing wrong?

@yuewang-cuhk
Copy link
Contributor

Hi, the model behind the AI coding assistant GIF demo is the CodeT5-base model fine-tuned on Apex code corpurs. Generally if you want to apply CodeT5 for generating code or summaries, you need to fine-tune the model on your specific downstream tasks instead of directly using the pretrained models. For code summarization, we have released Salesforce/codet5-base-multi-sum which you can directly employ for generating summaries for functions in 6 PLs (Ruby/JavaScript/Go/Python/Java/PHP).

@kiwih
Copy link
Author

kiwih commented Nov 23, 2021

That's disappointing. I would recommend removing the gif or replacing it with one that is more representative of the models actually present in this repository (i.e. have it show the performance of one of the snap shots). Alternatively, can you share the model that is fine-tuned over Apex?

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

2 participants