Instructions to use zamal/gemma-7b-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zamal/gemma-7b-finetuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zamal/gemma-7b-finetuned") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("zamal/gemma-7b-finetuned") model = AutoModelForCausalLM.from_pretrained("zamal/gemma-7b-finetuned") 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 zamal/gemma-7b-finetuned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zamal/gemma-7b-finetuned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zamal/gemma-7b-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/zamal/gemma-7b-finetuned
- SGLang
How to use zamal/gemma-7b-finetuned 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 "zamal/gemma-7b-finetuned" \ --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": "zamal/gemma-7b-finetuned", "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 "zamal/gemma-7b-finetuned" \ --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": "zamal/gemma-7b-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use zamal/gemma-7b-finetuned with Docker Model Runner:
docker model run hf.co/zamal/gemma-7b-finetuned
Fine-tuned Model for Prompt Enhancement βοΈ
Overview
This model is fine-tuned using the QLORA (Quantized Low Rank Adaptation) approach, specifically designed to enhance textual prompts. The primary objective of this model is to take a user's initial prompt and refine it into the best possible version, optimizing clarity, engagement, and effectiveness. This capability makes it an invaluable tool for a wide range of applications, from improving chatbot interactions to enhancing creative writing processes.
Features
- Prompt Optimization: Inputs an initial, potentially unrefined prompt and outputs a significantly improved version.
- Broad Application: Suitable for content creators, marketers, developers creating interactive AI, and more.
How It Works
The model operates by analyzing the structure, content, and intent behind the input prompt. Using the QLORA fine-tuning methodology, it identifies areas for enhancement and generates a revised version that better captures the intended message or question, ensuring higher engagement and clearer communication.
Model input: "C program to add two numbers"
Improved Prompt as output: "Implement a C program that takes two integer inputs and calculates their sum"
Model input: "I wanna learn Martial Arts"
Improved Prompt as output: "Explain the steps one would take to learn martial arts, from beginner to advanced levels."
Usage
This model can be accessed via the Hugging Face API or directly integrated into applications through our provided endpoints. Here's a simple example of how to use the model via the Hugging Face API:
import requests
API_URL = "/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fmodels%2Fzamal%2Fgemma-7b-finetuned"
headers = {"Authorization": "Bearer <your-api-key>"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
output = query({
"inputs": "Your initial prompt here",
})
print(output)
- Downloads last month
- 11