Skip to content

Commit 9bcadbe

Browse files
authored
Update with Huggingface interface
1 parent d092593 commit 9bcadbe

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,33 @@ Authors: [Jiyang Zhang](https://jiyangzhang.github.io/), [Pengyu Nie](https://pe
1515
}
1616
```
1717

18+
## News
19+
May 2024
20+
The fine-tuned EditsTranslation model is released on 🤗 ! 🔥[cs2java](https://huggingface.co/EngineeringSoftware/EditsTranslation-cs2java) and [java2cs](https://huggingface.co/EngineeringSoftware/EditsTranlation-java2cs/settings)
21+
22+
## How to Use
23+
24+
[sec-howto]: #how-to-use
25+
26+
```python
27+
from transformers import T5ForConditionalGeneration, AutoTokenizer
28+
29+
checkpoint = "EngineeringSoftware/EditsTranlation-java2cs"
30+
31+
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
32+
model = T5ForConditionalGeneration.from_pretrained(checkpoint)
33+
34+
code_input = """class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!")"""
35+
36+
input_ids = tokenizer(code_input, return_tensors="pt").input_ids
37+
generated_ids = model.generate(input_ids, max_length=200)
38+
print(tokenizer.decode(generated_ids[0], skip_special_tokens=True))
39+
# output: <INSERT>; } } ;<INSERT_END> class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!") ; } } ;
40+
```
41+
42+
43+
44+
1845
## Introduction
1946

2047
This repo contains the code and artifacts for reproducing the experiments in [Multilingual Code Co-Evolution Using Large Language Models](https://arxiv.org/abs/2307.14991).

0 commit comments

Comments
 (0)