ejschwartz commited on
Commit
f183304
·
1 Parent(s): 1311a82

remove field decoding

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -28,6 +28,7 @@ and I reused some of their own code to do this.
28
 
29
  ## Todo
30
 
 
31
  * Add examples
32
 
33
  """
@@ -76,11 +77,11 @@ def infer(code):
76
  var_name = vars[0]
77
 
78
  # ejs: Yeah, this var_name thing is really bizarre. But look at https://github.com/lt-asset/resym/blob/main/training_src/fielddecoder_inf.py
79
- prompt = f"What are the original name and data types of variables {varstring}?\n```\n{code}\n```{var_name}"
80
 
81
- print(f"Prompt:\n{prompt}")
82
 
83
- input_ids = tokenizer.encode(prompt, return_tensors="pt").cuda()[:, : 8192 - 1024]
84
  var_output = vardecoder_model.generate(
85
  input_ids=input_ids,
86
  max_new_tokens=1024,
@@ -114,7 +115,7 @@ def infer(code):
114
 
115
  var_output = var_name + ":" + var_output
116
  field_output = var_name + ":" + field_output
117
- return var_output, field_output, varstring
118
 
119
 
120
  demo = gr.Interface(
@@ -124,7 +125,7 @@ demo = gr.Interface(
124
  ],
125
  outputs=[
126
  gr.Text(label="Var Decoder Output"),
127
- gr.Text(label="Field Decoder Output"),
128
  gr.Text(label="Generated Variable List"),
129
  ],
130
  description=description,
 
28
 
29
  ## Todo
30
 
31
+ * Add field decoding
32
  * Add examples
33
 
34
  """
 
77
  var_name = vars[0]
78
 
79
  # ejs: Yeah, this var_name thing is really bizarre. But look at https://github.com/lt-asset/resym/blob/main/training_src/fielddecoder_inf.py
80
+ var_prompt = f"What are the original name and data types of variables {varstring}?\n```\n{code}\n```{var_name}"
81
 
82
+ print(f"Prompt:\n{var_prompt}")
83
 
84
+ input_ids = tokenizer.encode(var_prompt, return_tensors="pt").cuda()[:, : 8192 - 1024]
85
  var_output = vardecoder_model.generate(
86
  input_ids=input_ids,
87
  max_new_tokens=1024,
 
115
 
116
  var_output = var_name + ":" + var_output
117
  field_output = var_name + ":" + field_output
118
+ return var_output, varstring
119
 
120
 
121
  demo = gr.Interface(
 
125
  ],
126
  outputs=[
127
  gr.Text(label="Var Decoder Output"),
128
+ #gr.Text(label="Field Decoder Output"),
129
  gr.Text(label="Generated Variable List"),
130
  ],
131
  description=description,