Instructions to use mparts/CODer-unixcoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mparts/CODer-unixcoder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="mparts/CODer-unixcoder")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mparts/CODer-unixcoder", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
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 |
|