ejschwartz commited on
Commit
8e536a8
·
1 Parent(s): a7c1b7f

Disable field model

Browse files
Files changed (1) hide show
  1. app.py +21 -19
app.py CHANGED
@@ -20,6 +20,8 @@ This space simply performs inference on the two pretrained models available as
20
  part of the ReSym artifacts. It takes a variable name and some decompiled code
21
  as input, and outputs the variable type and other information.
22
 
 
 
23
  ## Disclaimer
24
 
25
  I'm not a ReSym developer and I may have messed something up. In particular,
@@ -39,9 +41,9 @@ tokenizer = AutoTokenizer.from_pretrained("bigcode/starcoderbase-3b")
39
  vardecoder_model = AutoModelForCausalLM.from_pretrained(
40
  "ejschwartz/resym-vardecoder", torch_dtype=torch.bfloat16, device_map="auto"
41
  )
42
- fielddecoder_model = AutoModelForCausalLM.from_pretrained(
43
- "ejschwartz/resym-fielddecoder", torch_dtype=torch.bfloat16, device_map="auto"
44
- )
45
 
46
  example = r"""__int64 __fastcall sub_410D81(__int64 a1, __int64 a2, __int64 a3)
47
  {
@@ -103,24 +105,24 @@ def infer(code):
103
  skip_special_tokens=True,
104
  clean_up_tokenization_spaces=True,
105
  )
106
- field_output = fielddecoder_model.generate(
107
- input_ids=input_ids,
108
- max_new_tokens=1024,
109
- num_beams=4,
110
- num_return_sequences=1,
111
- do_sample=False,
112
- early_stopping=False,
113
- pad_token_id=0,
114
- eos_token_id=0,
115
- )[0]
116
- field_output = tokenizer.decode(
117
- field_output[input_ids.size(1) :],
118
- skip_special_tokens=True,
119
- clean_up_tokenization_spaces=True,
120
- )
121
 
122
  var_output = var_name + ":" + var_output
123
- field_output = var_name + ":" + field_output
124
  return var_output, varstring
125
 
126
 
 
20
  part of the ReSym artifacts. It takes a variable name and some decompiled code
21
  as input, and outputs the variable type and other information.
22
 
23
+ The examples are randomly selected from `vardecoder_test.jsonl`.
24
+
25
  ## Disclaimer
26
 
27
  I'm not a ReSym developer and I may have messed something up. In particular,
 
41
  vardecoder_model = AutoModelForCausalLM.from_pretrained(
42
  "ejschwartz/resym-vardecoder", torch_dtype=torch.bfloat16, device_map="auto"
43
  )
44
+ # fielddecoder_model = AutoModelForCausalLM.from_pretrained(
45
+ # "ejschwartz/resym-fielddecoder", torch_dtype=torch.bfloat16, device_map="auto"
46
+ # )
47
 
48
  example = r"""__int64 __fastcall sub_410D81(__int64 a1, __int64 a2, __int64 a3)
49
  {
 
105
  skip_special_tokens=True,
106
  clean_up_tokenization_spaces=True,
107
  )
108
+ # field_output = fielddecoder_model.generate(
109
+ # input_ids=input_ids,
110
+ # max_new_tokens=1024,
111
+ # num_beams=4,
112
+ # num_return_sequences=1,
113
+ # do_sample=False,
114
+ # early_stopping=False,
115
+ # pad_token_id=0,
116
+ # eos_token_id=0,
117
+ # )[0]
118
+ # field_output = tokenizer.decode(
119
+ # field_output[input_ids.size(1) :],
120
+ # skip_special_tokens=True,
121
+ # clean_up_tokenization_spaces=True,
122
+ # )
123
 
124
  var_output = var_name + ":" + var_output
125
+ #field_output = var_name + ":" + field_output
126
  return var_output, varstring
127
 
128