Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- code_search_net
|
4 |
+
language:
|
5 |
+
- code
|
6 |
+
pipeline_tag: text-classification
|
7 |
+
inference: false
|
8 |
+
tags:
|
9 |
+
- code
|
10 |
+
- programming-language
|
11 |
+
---
|
12 |
+
|
13 |
+
# ONNX version of huggingface/CodeBERTa-language-id
|
14 |
+
|
15 |
+
**This model is conversion of [huggingface/CodeBERTa-language-id](https://huggingface.co/huggingface/CodeBERTa-language-id) to ONNX.** The model was converted to ONNX using the [🤗 Optimum](https://huggingface.co/docs/optimum/index) library.
|
16 |
+
|
17 |
+
## Model Architecture
|
18 |
+
|
19 |
+
**Base Model**: CodeBERTa, a variant of the RoBERTa model trained specifically for programming languages.
|
20 |
+
|
21 |
+
**Modifications**: No changes except for the conversion.
|
22 |
+
|
23 |
+
## Usage
|
24 |
+
|
25 |
+
Loading the model requires the [🤗 Optimum](https://huggingface.co/docs/optimum/index) library installed.
|
26 |
+
|
27 |
+
```python
|
28 |
+
from optimum.onnxruntime import ORTModelForSequenceClassification
|
29 |
+
from transformers import AutoTokenizer, pipeline
|
30 |
+
|
31 |
+
|
32 |
+
tokenizer = AutoTokenizer.from_pretrained("laiyer/CodeBERTa-language-id")
|
33 |
+
model = ORTModelForSequenceClassification.from_pretrained("laiyer/CodeBERTa-language-id")
|
34 |
+
classifier = pipeline(
|
35 |
+
task="text-classification",
|
36 |
+
model=model,
|
37 |
+
tokenizer=tokenizer,
|
38 |
+
)
|
39 |
+
|
40 |
+
print(classifier("""
|
41 |
+
def f(x):
|
42 |
+
return x**2
|
43 |
+
"""))
|
44 |
+
```
|