Text Generation
Transformers
Safetensors
phi3
conversational
custom_code
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use vrpatel/power-converter with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use vrpatel/power-converter with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="vrpatel/power-converter", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("vrpatel/power-converter", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("vrpatel/power-converter", trust_remote_code=True, device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use vrpatel/power-converter with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "vrpatel/power-converter" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "vrpatel/power-converter", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/vrpatel/power-converter
- SGLang
How to use vrpatel/power-converter 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 "vrpatel/power-converter" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "vrpatel/power-converter", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "vrpatel/power-converter" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "vrpatel/power-converter", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use vrpatel/power-converter with Docker Model Runner:
docker model run hf.co/vrpatel/power-converter
Model Description
The power-converter model provides responses to aid with queries about power electronic converters. The model underwent SFT using QloRA on Microsoft's Phi-3-Mini-4K-Instruct using a fully synthetic dataset.
- Developed by: Vinesh Patel
- Finetuned from model: microsoft/Phi-3-mini-4k-instruct
- Acknowledgement:
- This work has used Durham University鈥檚 NCC cluster. NCC has been purchased through Durham University鈥檚 strategic investment funds, and is installed and maintained by the Department of Computer Science.
- This work made use of the facilities of the N8 Centre of Excellence in Computationally Intensive Research (N8 CIR) provided and funded by the N8 research partnership and EPSRC (Grant No. EP/T022167/1). The Centre is coordinated by the Universities of Durham, Manchester and York.
- Repository: [More Information Needed]
- Paper: [More Information Needed]
Getting Started
Use the code below to get started with the model.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"vrpatel/power-converter",
device_map="auto",
torch_dtype="auto")
tokenizer = AutoTokenizer.from_pretrained("vrpatel/power-converter")
messages = [
{"role": "system", "content": "You are a helpful assistant knowledgeable about power converters."},
{"role": "user", "content": <user_input>"}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt"
).to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=2048,
do_sample=True
)
response = tokenizer.decode(
outputs[0][len(inputs.input_ids[0]):],
skip_special_tokens=True
)
- Downloads last month
- 7