how to use this?

#5
by Rajanpanchal - opened

I am using inference API and sent a class and it sent back is "{ generated_text: 'Please remove this extra line' } " I dont know what it means

I agree the instructions on how to get this up and running and how to prompt the model properly are very vague.

I found these ways

image.png

from transformers import pipeline

pipe = pipeline("text2text-generation", model="microsoft/codereviewer")

code = """
public class MockExecutorLoader implements ExecutorLoader {
public void unassignExecutor(int executionId) throws ExecutorManagerException {
executionExecutorMapping.remove(executionId);
}
[ADD]
[ADD] 

@Override
	
[ADD] public List<ExecutableFlow> fetchRecentlyFinishedFlows(long lifeTimeMs)
[ADD] throws ExecutorManagerException {
[ADD] return null;
[ADD] }
}
"""

pipe(code, max_length=512, num_return_sequences=1)[0]["generated_text"]

image.png

code_diff = """@@ -11,6 +11,8 @@\n \n         invoiceDtoCopy.setState(InvoiceState.OPEN);\n         _invoiceAggregateRepository.updateInvoiceState(invoiceCopy, InvoiceState.OPEN);\n+        _erpIntegrationService.createAndSendInvoiceEvent(invoiceCopy);\n+\n       }\n     }\n \n"""
print('code: ',code_diff)
pipe(code_diff, max_length=512, num_return_sequences=1)[0]["generated_text"]

ref:-
https://arxiv.org/pdf/2203.09095.pdf

image.png

image.png

Sign up or log in to comment