mparts commited on
Commit
5c6463b
·
verified ·
1 Parent(s): 19dd822

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -1
README.md CHANGED
@@ -39,9 +39,11 @@ from transformers import AutoModelForSequenceClassification, AutoTokenizer
39
  repo, variant = "mparts/CODer-unixcoder", "seed3/binary"
40
  tok = AutoTokenizer.from_pretrained(repo, subfolder=variant)
41
  model = AutoModelForSequenceClassification.from_pretrained(repo, subfolder=variant)
 
 
42
  ~~~
43
 
44
- The models were trained on whitespace-normalised code (line endings unified, tabs expanded to four spaces, trailing spaces and outer blank lines removed: `normalise()` in `src/code_origin/data/preprocess.py`), truncated to 256 tokens. Normalise inputs the same way.
45
 
46
  ## Training
47
 
 
39
  repo, variant = "mparts/CODer-unixcoder", "seed3/binary"
40
  tok = AutoTokenizer.from_pretrained(repo, subfolder=variant)
41
  model = AutoModelForSequenceClassification.from_pretrained(repo, subfolder=variant)
42
+ inputs = tok(code, truncation=True, max_length=256, return_tensors="pt") # code: one normalised string
43
+ probs = model(**inputs).logits.softmax(-1)
44
  ~~~
45
 
46
+ The models were trained on whitespace-normalised code (line endings unified, tabs expanded to four spaces, trailing spaces and outer blank lines removed: `normalise()` in `src/code_origin/data/preprocess.py`), truncated to 256 tokens. Normalise inputs the same way, and keep `truncation=True, max_length=256`: the saved tokenizer has no length limit of its own, so without them longer code is not cut at 256 tokens as in training.
47
 
48
  ## Training
49