File size: 1,265 Bytes
43420b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42b1426
 
 
 
 
 
eb74a50
42b1426
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eb74a50
42b1426
 
 
 
 
 
 
 
 
 
 
eb74a50
42b1426
eb74a50
42b1426
 
0231716
 
42b1426
eb74a50
42b1426
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
language: code
tags:
  - code
  - translation
  - codet5
  - vbnet
  - csharp
  - programming
  - source-code
datasets:
  - custom
license: mit
library_name: transformers
pipeline_tag: translation
model_type: codet5
---
# πŸš€ CodeT5 VB.NET β†’ C# Translator

This is a fine-tuned version of [Salesforce/CodeT5-base](https://huggingface.co/Salesforce/codet5-base) for translating VB.NET to C#.

---

# πŸ“Š Evaluation Metrics

**BLEU Score:** 0.4506  
- 1-gram: 0.6698  
- 2-gram: 0.5402  
- 3-gram: 0.4656  
- 4-gram: 0.4132  
- Brevity penalty: 0.8773  
- Length ratio: 0.8843  

**ROUGE Scores:**  
- ROUGE-1: 0.5836  
- ROUGE-2: 0.4586  
- ROUGE-L: 0.5378  
- ROUGE-Lsum: 0.5781

---

# πŸ”§ Usage

```python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

model = AutoModelForSeq2SeqLM.from_pretrained("{repo_id}")
tokenizer = AutoTokenizer.from_pretrained("{repo_id}")

vb_code = "Dim x As Integer = 5"
inputs = tokenizer(f"translate VB.NET to C#: {vb_code}", return_tensors="pt")
outputs = model.generate(**inputs)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

# πŸ“ Dataset Format

Training data was in JSONL with fields:
- `"vb_code"`: VB.NET input  
- `"csharp_code"`: corresponding C# output

# πŸ“„ License

MIT