Downloads · 30 days
0
arhansd1/Csv-AI-Cleaner-V3
Csv-AI-Cleaner-V3 is a machine learning model from arhansd1. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Transform English instructions with data context into executable pandas code with AI
Downloads · 30 days
0
Access
Public
Updated Aug 12, 2025
Repo size
3.6 MB
Likes
1
Public
Click a slice to open those files.
.safetensors3.6 MB · 53%
From the Hugging Face model README
Transform English instructions with data context into executable pandas code with AI
Csv-AI-Cleaner converts natural language instructions into pandas code for data cleaning, filtering, grouping, sorting, merges, and more.
Fine-tuned on synthetic + real-world datasets using CodeT5 with LoRA for efficiency.
Example:
Context:
employee_id | name | salary | department
E001 | Alice | 50000 | IT
E002 | Bob | 45000 | HR
Instruction: Show IT department employees earning over 45000
Output:
df[(df['department'] == 'IT') & (df['salary'] > 45000)]
Users should verify generated code for correctness and safety before execution.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import torch
MODEL_REPO = "arhansd1/Csv-AI-Cleaner-V3"
tokenizer = AutoTokenizer.from_pretrained(MODEL_REPO)
model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_REPO)
def generate_code(input_text):
prefixed_input = "Generate pandas code: " + input_text
inputs = tokenizer(prefixed_input, return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
outputs = model.generate(
input_ids=inputs.input_ids,
attention_mask=inputs.attention_mask,
max_length=128,
num_beams=5,
temperature=0.7,
early_stopping=True
)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
# Example
input_example = """
Context:
employee_id | name | salary | department
E001 | Alice | 50000 | IT
E002 | Bob | 45000 | HR
Instruction: Show IT department employees earning over 45000
"""
print(generate_code(input_example))
| Metric | Score |
|---|---|
| Exact Match | 71% |
| Partial Match | 92% |
| Syntax Accuracy | 100% |
High syntax accuracy, good partial match rate, slightly lower exact match on multi-condition or chained operations.