Downloads · 30 days
18
7% of all-time downloads
nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code
Llama-3-8B_SFT_Finetune_Pandas_Code is a text generation model from nirusanan. Use it when you need the model to write or continue text. It is set up for transformers.
The Llama-3-8BSFTFinetunePandasCode is a quantized, fine-tuned version of the Meta-Llama-3 model designed specifically for analyzing tabular data.
Downloads · 30 days
18
7% of all-time downloads
All-time downloads
276
Public
Parameters
8B
32.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors32.1 GB · 100%
From the Hugging Face model README
The Llama-3-8B_SFT_Finetune_Pandas_Code is a quantized, fine-tuned version of the Meta-Llama-3 model designed specifically for analyzing tabular data.
Starting with transformers version 4.34.0 and later, you can run conversational inference using the Transformers pipeline.
Make sure to update your transformers installation via pip install --upgrade transformers.
import transformers
import torch
from peft import PeftModel, PeftConfig, get_peft_model
from transformers import pipeline
def get_pipline():
model_name = "nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code"
tokenizer = AutoTokenizer.from_pretrained(model_name)
tokenizer.pad_token = tokenizer.eos_token
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="cuda:0",
trust_remote_code=True
)
pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer, max_length=850)
return pipe
pipe = get_pipline()
def generate_prompt(task, header_columns):
prompt = f"""Below is an instruction that describes a task. Write a Python function using Pandas to accomplish the task described below.
### Instruction:
{task}
header columns with sample data:
{header_columns}
### Response:
"""
return prompt
prompt = generate_prompt("Your question based on tabular data", "Necessary columns names")
result = pipe(prompt)
generated_text = result[0]['generated_text']
print(generated_text.split("### End")[0])