Instructions to use VaidikML0508/Access-Me-Instruct-V2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use VaidikML0508/Access-Me-Instruct-V2 with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("VaidikML0508/Access-Me-Instruct-V2", dtype="auto") - llama-cpp-python
How to use VaidikML0508/Access-Me-Instruct-V2 with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="VaidikML0508/Access-Me-Instruct-V2", filename="Vaidik_access_me_V2.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use VaidikML0508/Access-Me-Instruct-V2 with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf VaidikML0508/Access-Me-Instruct-V2 # Run inference directly in the terminal: llama-cli -hf VaidikML0508/Access-Me-Instruct-V2
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf VaidikML0508/Access-Me-Instruct-V2 # Run inference directly in the terminal: llama-cli -hf VaidikML0508/Access-Me-Instruct-V2
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf VaidikML0508/Access-Me-Instruct-V2 # Run inference directly in the terminal: ./llama-cli -hf VaidikML0508/Access-Me-Instruct-V2
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf VaidikML0508/Access-Me-Instruct-V2 # Run inference directly in the terminal: ./build/bin/llama-cli -hf VaidikML0508/Access-Me-Instruct-V2
Use Docker
docker model run hf.co/VaidikML0508/Access-Me-Instruct-V2
- LM Studio
- Jan
- Ollama
How to use VaidikML0508/Access-Me-Instruct-V2 with Ollama:
ollama run hf.co/VaidikML0508/Access-Me-Instruct-V2
- Unsloth Studio new
How to use VaidikML0508/Access-Me-Instruct-V2 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for VaidikML0508/Access-Me-Instruct-V2 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for VaidikML0508/Access-Me-Instruct-V2 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for VaidikML0508/Access-Me-Instruct-V2 to start chatting
- Pi new
How to use VaidikML0508/Access-Me-Instruct-V2 with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf VaidikML0508/Access-Me-Instruct-V2
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "VaidikML0508/Access-Me-Instruct-V2" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use VaidikML0508/Access-Me-Instruct-V2 with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf VaidikML0508/Access-Me-Instruct-V2
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default VaidikML0508/Access-Me-Instruct-V2
Run Hermes
hermes
- Docker Model Runner
How to use VaidikML0508/Access-Me-Instruct-V2 with Docker Model Runner:
docker model run hf.co/VaidikML0508/Access-Me-Instruct-V2
- Lemonade
How to use VaidikML0508/Access-Me-Instruct-V2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull VaidikML0508/Access-Me-Instruct-V2
Run and chat with the model
lemonade run user.Access-Me-Instruct-V2-{{QUANT_TAG}}List all available models
lemonade list
Delete handler.py
Browse files- handler.py +0 -102
handler.py
DELETED
|
@@ -1,102 +0,0 @@
|
|
| 1 |
-
from typing import Dict, List, Any
|
| 2 |
-
import torch
|
| 3 |
-
from unsloth import FastLanguageModel
|
| 4 |
-
import os
|
| 5 |
-
|
| 6 |
-
class EndpointHandler:
|
| 7 |
-
def __init__(self, path=""):
|
| 8 |
-
# Model configuration
|
| 9 |
-
self.max_seq_length = 8192
|
| 10 |
-
self.load_in_4bit = True
|
| 11 |
-
self.dtype = None # Auto detection
|
| 12 |
-
|
| 13 |
-
# Print the CUDA version
|
| 14 |
-
print(f"CUDA version: {torch.version.cuda}")
|
| 15 |
-
|
| 16 |
-
# Load model and tokenizer
|
| 17 |
-
self.model_id = "VaidikML0508/Access-Me-Instruct-V2"
|
| 18 |
-
self.model, self.tokenizer = FastLanguageModel.from_pretrained(
|
| 19 |
-
model_name=self.model_id,
|
| 20 |
-
max_seq_length=self.max_seq_length,
|
| 21 |
-
dtype=self.dtype,
|
| 22 |
-
load_in_4bit=self.load_in_4bit,
|
| 23 |
-
token=os.environ['HF_KEY'] # Replace with actual token if needed
|
| 24 |
-
)
|
| 25 |
-
|
| 26 |
-
# Prepare model for inference
|
| 27 |
-
FastLanguageModel.for_inference(self.model)
|
| 28 |
-
|
| 29 |
-
# Define prompt template
|
| 30 |
-
self.prompt_template = """<|begin_of_text|><|start_header_id|>system<|end_header_id|>
|
| 31 |
-
{}<|eot_id|><|start_header_id|>user<|end_header_id|>
|
| 32 |
-
{}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
|
| 33 |
-
{}<|eot_id|>"""
|
| 34 |
-
|
| 35 |
-
def __call__(self, data: Dict[str, Any]) -> Dict[str, str]:
|
| 36 |
-
"""
|
| 37 |
-
Handle inference request
|
| 38 |
-
:param data: Dictionary containing 'system_instruction', 'question', and optional parameters
|
| 39 |
-
:return: Dictionary containing generated response
|
| 40 |
-
"""
|
| 41 |
-
# Extract inputs
|
| 42 |
-
system_instruction = data.pop("system_instruction", "You are a helpful AI assistant.")
|
| 43 |
-
question = data.pop("question", None)
|
| 44 |
-
|
| 45 |
-
# Check if question is provided
|
| 46 |
-
if question is None:
|
| 47 |
-
return {"error": "Please provide a question."}
|
| 48 |
-
|
| 49 |
-
# Extract generation parameters
|
| 50 |
-
max_new_tokens = data.pop("max_new_tokens", 200)
|
| 51 |
-
use_cache = data.pop("use_cache", True)
|
| 52 |
-
|
| 53 |
-
try:
|
| 54 |
-
# Prepare input prompt
|
| 55 |
-
formatted_prompt = self.prompt_template.format(
|
| 56 |
-
system_instruction,
|
| 57 |
-
question,
|
| 58 |
-
"" # Empty output for generation
|
| 59 |
-
)
|
| 60 |
-
|
| 61 |
-
# Tokenize input
|
| 62 |
-
inputs = self.tokenizer(
|
| 63 |
-
[formatted_prompt],
|
| 64 |
-
return_tensors="pt"
|
| 65 |
-
).to("cuda")
|
| 66 |
-
|
| 67 |
-
# Generate response
|
| 68 |
-
outputs = self.model.generate(
|
| 69 |
-
**inputs,
|
| 70 |
-
max_new_tokens=max_new_tokens,
|
| 71 |
-
use_cache=use_cache
|
| 72 |
-
)
|
| 73 |
-
|
| 74 |
-
# Decode output
|
| 75 |
-
generated_text = self.tokenizer.batch_decode(outputs)[0]
|
| 76 |
-
# print(generated_text)
|
| 77 |
-
# Extract the assistant's response
|
| 78 |
-
# Find the last assistant section in the generated text
|
| 79 |
-
assistant_parts = generated_text.split("<|start_header_id|>assistant<|end_header_id|>")
|
| 80 |
-
if len(assistant_parts) > 1:
|
| 81 |
-
response = assistant_parts[-1].replace('<|eot_id|>', "").strip(" \n")
|
| 82 |
-
else:
|
| 83 |
-
response = generated_text
|
| 84 |
-
|
| 85 |
-
return {
|
| 86 |
-
"generated_text": response,
|
| 87 |
-
"full_prompt": formatted_prompt
|
| 88 |
-
}
|
| 89 |
-
|
| 90 |
-
except Exception as e:
|
| 91 |
-
return {
|
| 92 |
-
"error": f"Generation failed: {str(e)}",
|
| 93 |
-
"full_prompt": formatted_prompt if 'formatted_prompt' in locals() else None
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
@staticmethod
|
| 97 |
-
def check_cuda():
|
| 98 |
-
"""
|
| 99 |
-
Verify CUDA availability
|
| 100 |
-
"""
|
| 101 |
-
if not torch.cuda.is_available():
|
| 102 |
-
raise ValueError("CUDA is required for this model")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|