Instructions to use nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code") model = AutoModelForCausalLM.from_pretrained("nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code
- SGLang
How to use nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code with Docker Model Runner:
docker model run hf.co/nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code
Model Information
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.
How to use
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])
- Downloads last month
- 1
Model tree for nirusanan/Llama-3-8B_SFT_Finetune_Pandas_Code
Base model
meta-llama/Meta-Llama-3-8B