Instructions to use Navaneeth-14/rag-hackathon-app with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Navaneeth-14/rag-hackathon-app with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Navaneeth-14/rag-hackathon-app:Q4_K_M # Run inference directly in the terminal: llama cli -hf Navaneeth-14/rag-hackathon-app:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Navaneeth-14/rag-hackathon-app:Q4_K_M # Run inference directly in the terminal: llama cli -hf Navaneeth-14/rag-hackathon-app:Q4_K_M
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 Navaneeth-14/rag-hackathon-app:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Navaneeth-14/rag-hackathon-app:Q4_K_M
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 Navaneeth-14/rag-hackathon-app:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Navaneeth-14/rag-hackathon-app:Q4_K_M
Use Docker
docker model run hf.co/Navaneeth-14/rag-hackathon-app:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use Navaneeth-14/rag-hackathon-app with Ollama:
ollama run hf.co/Navaneeth-14/rag-hackathon-app:Q4_K_M
- Unsloth Studio
How to use Navaneeth-14/rag-hackathon-app 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 Navaneeth-14/rag-hackathon-app 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 Navaneeth-14/rag-hackathon-app to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Navaneeth-14/rag-hackathon-app to start chatting
- Docker Model Runner
How to use Navaneeth-14/rag-hackathon-app with Docker Model Runner:
docker model run hf.co/Navaneeth-14/rag-hackathon-app:Q4_K_M
- Lemonade
How to use Navaneeth-14/rag-hackathon-app with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Navaneeth-14/rag-hackathon-app:Q4_K_M
Run and chat with the model
lemonade run user.rag-hackathon-app-Q4_K_M
List all available models
lemonade list
- Atomic Chat
File size: 5,930 Bytes
09281fe | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | #!/usr/bin/env python3
"""
Performance analysis script to identify bottlenecks
"""
import os
import sys
import time
import cProfile
import pstats
from pathlib import Path
def analyze_performance():
"""Analyze performance of each component"""
print("β‘ PERFORMANCE ANALYSIS")
print("=" * 50)
try:
from rag_system import AdvancedRAGSystem
from document_processer import AdvancedDocumentProcessor
from vector_database import VectorDatabase
from query_parser import AdvancedQueryParser
from llm_reasoning import AdvancedLLMReasoning
file_path = "doc2.pdf"
if not os.path.exists(file_path):
print(f"β File not found: {file_path}")
return
print(f"π Testing with file: {file_path}")
# Test 1: Document Processing Performance
print("\n1οΈβ£ DOCUMENT PROCESSING PERFORMANCE")
print("-" * 40)
doc_processor = AdvancedDocumentProcessor()
start_time = time.time()
chunks = doc_processor.process_document(file_path, use_ocr=False)
doc_time = time.time() - start_time
print(f"β
Document processing: {doc_time:.2f}s")
print(f"π Chunks created: {len(chunks)}")
print(f"π Average time per chunk: {doc_time/len(chunks):.4f}s")
# Test 2: Vector Database Performance
print("\n2οΈβ£ VECTOR DATABASE PERFORMANCE")
print("-" * 40)
vector_db = VectorDatabase()
start_time = time.time()
success = vector_db.add_documents(chunks)
vector_time = time.time() - start_time
print(f"β
Vector database addition: {vector_time:.2f}s")
print(f"π Success: {success}")
print(f"π Average time per chunk: {vector_time/len(chunks):.4f}s")
# Test 3: Query Parser Performance
print("\n3οΈβ£ QUERY PARSER PERFORMANCE")
print("-" * 40)
query_parser = AdvancedQueryParser()
test_query = "Does the policy cover newborn care after hospital discharge?"
start_time = time.time()
parsed = query_parser.parse_query(test_query)
parser_time = time.time() - start_time
print(f"β
Query parsing: {parser_time:.2f}s")
print(f"π Query type: {parsed.query_type}")
print(f"π Confidence: {parsed.confidence}")
# Test 4: LLM Reasoning Performance
print("\n4οΈβ£ LLM REASONING PERFORMANCE")
print("-" * 40)
reasoning_engine = AdvancedLLMReasoning(use_gpu=False)
test_context = [{"content": "Sample policy content", "source_file": "test.pdf"}]
start_time = time.time()
result = reasoning_engine.analyze_query(test_query, test_context, "coverage_inquiry")
reasoning_time = time.time() - start_time
print(f"β
LLM reasoning: {reasoning_time:.2f}s")
print(f"π Decision: {result.decision}")
print(f"π Confidence: {result.confidence_score}")
# Test 5: Full RAG System Performance
print("\n5οΈβ£ FULL RAG SYSTEM PERFORMANCE")
print("-" * 40)
rag_system = AdvancedRAGSystem(use_gpu=False)
# Document ingestion
start_time = time.time()
rag_chunks = rag_system.ingest_document(file_path, use_ocr=False)
ingestion_time = time.time() - start_time
print(f"β
Document ingestion: {ingestion_time:.2f}s")
print(f"π Chunks ingested: {len(rag_chunks)}")
# Query processing
start_time = time.time()
query_result = rag_system.process_query(test_query)
query_time = time.time() - start_time
print(f"β
Query processing: {query_time:.2f}s")
print(f"π Total time: {ingestion_time + query_time:.2f}s")
# Performance Summary
print("\nπ PERFORMANCE SUMMARY")
print("=" * 50)
print(f"Document Processing: {doc_time:.2f}s ({doc_time/(ingestion_time + query_time)*100:.1f}%)")
print(f"Vector Database: {vector_time:.2f}s ({vector_time/(ingestion_time + query_time)*100:.1f}%)")
print(f"Query Parsing: {parser_time:.2f}s ({parser_time/(ingestion_time + query_time)*100:.1f}%)")
print(f"LLM Reasoning: {reasoning_time:.2f}s ({reasoning_time/(ingestion_time + query_time)*100:.1f}%)")
print(f"TOTAL TIME: {ingestion_time + query_time:.2f}s")
# Optimization Recommendations
print("\nπ‘ OPTIMIZATION RECOMMENDATIONS")
print("=" * 50)
if doc_time > 10:
print("π§ Document processing is slow - consider:")
print(" - Reduce chunk size")
print(" - Use parallel processing")
print(" - Optimize OCR settings")
if vector_time > 20:
print("π§ Vector database is slow - consider:")
print(" - Use GPU for embeddings")
print(" - Batch processing")
print(" - Reduce embedding dimensions")
if reasoning_time > 30:
print("π§ LLM reasoning is slow - consider:")
print(" - Use smaller model")
print(" - Enable GPU acceleration")
print(" - Reduce max tokens")
print(" - Use caching")
if ingestion_time + query_time > 30:
print("π§ Overall system is slow - consider:")
print(" - Enable GPU for all components")
print(" - Use model quantization")
print(" - Implement caching")
print(" - Parallel processing")
except Exception as e:
print(f"β Error: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
analyze_performance() |