Text Classification
Transformers
ONNX
Safetensors
English
roberta
code
programming-language
code-classification
text-embeddings-inference
Instructions to use philomath-1209/programming-language-identification with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use philomath-1209/programming-language-identification with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="philomath-1209/programming-language-identification")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("philomath-1209/programming-language-identification") model = AutoModelForSequenceClassification.from_pretrained("philomath-1209/programming-language-identification") - Inference
- Notebooks
- Google Colab
- Kaggle
ONNX-converted version of the model
#1
by asofter - opened
We decided to swap the existing model for the Code Scanner in llm-guard with your model. Our tests show much better accuracy compared to the HuggingFace's one.
To have faster inference, we use ONNX models converted using Optimum from HuggingFace.
Example of the repo with ONNX built-in: https://huggingface.co/laiyer/deberta-v3-base-prompt-injection
pip install transformers optimum[onnxruntime] optimum
model_path = "philomath-1209/programming-language-identification"
from transformers import pipeline, AutoTokenizer
from optimum.onnxruntime import ORTModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = ORTModelForSequenceClassification.from_pretrained(model_path, export=True)
from pathlib import Path
onnx_path = Path("onnx")
model.save_pretrained(onnx_path)
tokenizer.save_pretrained(onnx_path)
philomath-1209 changed pull request status to merged