[Question]retrained the original TransCoder model, translation was not good
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Domain
- machine-learning
Research direction
No repository files, tests, or entry points are named. Start by comparing the TransCoder_model_1 link with the reported TransCoder_my setup, including the 50G Java/Python datasets and changed layer, embedding, and head parameters; done means establishing why class translation differs from standalone-function translation.
Written by the indexing model from the issue text.
Description
Hi,
We recently trained the original transcoder model (python-java only),
and while the metrics looked good, the translation was not good.
Using TransCoder_model_1 for translation, it is possible to translate java classes into python classes,
but using our trained model cannot translate classes, only standalone functions can be translated.
- Why TransCoder_model_1 can translate classes?
- Is our model still not trained enough epoch?
- Is our model needing more training data?
- Is our model using the wrong datasets?
Translate
class Solution:
def count_components(self, n: int, edges: List[List[int]]) -> int:
graph = self.build_graph(n, edges)
visited = set()
num = 0
for node in range(n):
if node in visited:
continue
self.traversal_with_bfs(node, graph, visited)
num += 1
return num
def build_graph(self, n, edges):
graph = {node:[] for node in range(n)}
for pre_node, node in edges:
graph[pre_node].append(node)
graph[node].append(pre_node)
return graph
def traversal_with_bfs(self, node, graph, visited):
queue = collections.deque([node])
visited.add(node)
while queue:
current_node = queue.popleft()
for neighbor in graph[current_node]:
if neighbor in visited:
continue
queue.append(neighbor)
visited.add(neighbor)
TransCoder_model_1
public static class Solution {
int countComponents ( final int n , final List < List < Integer >> edges ) throws Exception {
final List < List < Integer >> graph = buildGraph ( n , edges ) ;
final Set < Integer > visited = new HashSet < Integer > ( ) ;
int num = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( i < visited . size ( ) ) {
continue ;
}
traversalWithBfs ( i , graph , visited ) ;
num ++ ;
}
return num ;
}
public void buildGraph ( final int n , final List < List < Integer >> edges ) throws Exception {
final Map < Integer , List < Integer >> graph = new HashMap < Integer , List < Integer >> ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
graph . put ( i , new ArrayList < Integer > ( ) ) ;
graph . get ( i ) . add ( i ) ;
}
traversalWithBfs ( n , graph , visited ) ;
}
public void traversalWithBfs ( final int node , final List < List < Integer >> graph , Set < Integer > visited ) throws Exception {
final Queue < List < Integer >> queue = new LinkedList < List < Integer >> ( ) ;
visited . add ( node ) ;
while ( queue . size ( ) > 0 ) {
final List < Integer > currentNode = queue . poll ( ) ;
for ( final List < Integer > neighbor : graph . get ( currentNode ) ) {
if ( neighbor . contains ( node ) ) {
continue ;
}
queue . add ( neighbor ) ;
visited . add ( neighbor ) ;
}
}
}
}
TransCoder_my
static void main ( ) {
new Solution ( ) . countComponents ( ) ;
for ( Node node : new LinkedList < > ( ) ) {
if ( node . visited . add ( node ) ) {
new Solution ( ) . queue ( ) ;
}
}
new Solution ( ) . queue ( ) ;
new Solution ( ) . queue ( ) ;
new Solution ( ) . queue ( ) ;
new Solution ( ) . queue ( ) ;
new Solution ( ) . queue ( ) ;
}
Env
2xGTX3090(24G)
java(50G)-python(50G)
Monolingual -> MLM
Monolingual Functions -> TransCoder(from pretrained MLM)
Changed params https://github.com/facebookresearch/CodeGen/issues/12#issuecomment-910566452
--n_layers 6
--emb_dim 1024
--n_heads 8
Results
| Model/Task | Java -> Python | Python -> Java | ||
| Beam Size | k=1 | k=10 | k=1 | k=10 |
| TransCoder_model_1 | 46.87 | 48.81 | 33.89 | 35.55 |
| TransCoder_model_2 | 46.87 | 47.73 | 32.64 | 35.97 |
| TransCoder from DOBF | 49.24 | 52.7 | 39.5 | 45.32 |
| TransCoder_my(epoch 430) | 73.267327 | 85.148515 | 58.585859 | 72.727273 |
- Dominant language
- Python
- Stars
- 777
- Forks
- 144
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from facebookresearch/CodeGen
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
facebookresearch/CodeGen#109 ·
-
Hash function Open
Difficulty 3/5 1-2 days Newbie friendliness 42/100
facebookresearch/CodeGen#108 ·
-
Dataset issues Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
facebookresearch/CodeGen#107 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
facebookresearch/CodeGen#106 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
facebookresearch/CodeGen#105 ·
All issues in facebookresearch/CodeGen
Similar issues
-
area: harness bug status: needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Human-Agent-Society/reef#625 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
learningequality/kolibri#15351 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Name consistency Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
eellak/triplestore#65 · 1 comment ·