Update README.md
Browse files
README.md
CHANGED
|
@@ -91,6 +91,43 @@ For a given code, the following programming language can be determined:
|
|
| 91 |
- Ruby
|
| 92 |
- C++
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
## Training and evaluation data
|
| 95 |
|
| 96 |
- training arguments:
|
|
|
|
| 91 |
- Ruby
|
| 92 |
- C++
|
| 93 |
|
| 94 |
+
## Usage
|
| 95 |
+
|
| 96 |
+
```python
|
| 97 |
+
checkpoint = "malteklaes/based-CodeBERTa-language-id-llm-module_uniVienna"
|
| 98 |
+
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
| 99 |
+
modelPOST = AutoTokenizer.from_pretrained(checkpoint)
|
| 100 |
+
|
| 101 |
+
myPipeline = TextClassificationPipeline(
|
| 102 |
+
model=AutoModelForSequenceClassification.from_pretrained(checkpoint, ignore_mismatched_sizes=True),
|
| 103 |
+
tokenizer=AutoTokenizer.from_pretrained(checkpoint)
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
CODE_TO_IDENTIFY_py = """
|
| 107 |
+
def is_prime(n):
|
| 108 |
+
if n <= 1:
|
| 109 |
+
return False
|
| 110 |
+
if n == 2 or n == 3:
|
| 111 |
+
return True
|
| 112 |
+
if n % 2 == 0:
|
| 113 |
+
return False
|
| 114 |
+
max_divisor = int(n ** 0.5)
|
| 115 |
+
for i in range(3, max_divisor + 1, 2):
|
| 116 |
+
if n % i == 0:
|
| 117 |
+
return False
|
| 118 |
+
return True
|
| 119 |
+
|
| 120 |
+
number = 17
|
| 121 |
+
if is_prime(number):
|
| 122 |
+
print(f"{number} is a prime number.")
|
| 123 |
+
else:
|
| 124 |
+
print(f"{number} is not a prime number.")
|
| 125 |
+
|
| 126 |
+
"""
|
| 127 |
+
|
| 128 |
+
myPipeline(CODE_TO_IDENTIFY_py)
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
## Training and evaluation data
|
| 132 |
|
| 133 |
- training arguments:
|