This model is a fine-tuned version of
Snowflake/snowflake-arctic-embed-m
on a dataset of Python files labeled by Llama3 for educational value.
We used this classifier to build the
Python-Edu
dataset.
How to use in transformers
To load the Python-Edu classifier, use the following code:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/python-edu-scorer")
model = AutoModelForSequenceClassification.from_pretrained("HuggingFaceTB/python-edu-scorer")
text = "This is a test sentence."
inputs = tokenizer(text, return_tensors="pt", padding="longest", truncation=True)
outputs = model(**inputs)
logits = outputs.logits.squeeze(-1).float().detach().numpy()
score = logits.item()
result = {
"text": text,
"score": score,
"int_score": int(round(max(0, min(score, 5)))),
}
print(result)
# {'text': 'This is a test sentence.', 'score': 0.07964489609003067, 'int_score': 0}
Intended uses & limitations
While the Python-Edu classifier performs well in distinguishing high-quality python code, there are some limitations:
Scope: The model's performance might change for other datasets, in particular for out of distribution samples. It is also focused on educational content relevant to beginners and may not perform as well on content intended for higher education or specialized domains.
Bias: The model's performance is dependent on the quality and representativeness of the training data and the LLM used for the annotation. Biases in both can affect the classifier's judgments. It might overfit to thoroughly commented code.
Context: The classifier evaluates individual code files without considering broader context, which might impact its effectiveness in certain scenarios.
The classifier was trained on 450,000 pairs of python code files and their scores from 1 to 5, generated by Llama3. The samples were annotated based on their educational quality with 1 being not educational and 5 being highly educational.
We added a classification head with a single regression output to
Snowflake-arctic-embed
and trained the model for 20 epochs with a learning rate of 3e-4. During training, the embedding and encoder layers were frozen to focus on the classification head.
Training hyperparameters
The following hyperparameters were used during training:
learning_rate: 0.0003
train_batch_size: 256
eval_batch_size: 128
seed: 0
optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
python-edu-scorer huggingface.co is an AI model on huggingface.co that provides python-edu-scorer's model effect (), which can be used instantly with this HuggingFaceTB python-edu-scorer model. huggingface.co supports a free trial of the python-edu-scorer model, and also provides paid use of the python-edu-scorer. Support call python-edu-scorer model through api, including Node.js, Python, http.
python-edu-scorer huggingface.co is an online trial and call api platform, which integrates python-edu-scorer's modeling effects, including api services, and provides a free online trial of python-edu-scorer, you can try python-edu-scorer online for free by clicking the link below.
HuggingFaceTB python-edu-scorer online free url in huggingface.co:
python-edu-scorer is an open source model from GitHub that offers a free installation service, and any user can find python-edu-scorer on GitHub to install. At the same time, huggingface.co provides the effect of python-edu-scorer install, users can directly use python-edu-scorer installed effect in huggingface.co for debugging and trial. It also supports api for free installation.