Text Generation
Transformers
Safetensors
English
gemma
standalone
merged-weights
pdf-optimized
vision-guided-training
text-generation-inference
Instructions to use singtan/solvrays-finetuned-pdf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use singtan/solvrays-finetuned-pdf with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="singtan/solvrays-finetuned-pdf")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("singtan/solvrays-finetuned-pdf") model = AutoModelForCausalLM.from_pretrained("singtan/solvrays-finetuned-pdf") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use singtan/solvrays-finetuned-pdf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "singtan/solvrays-finetuned-pdf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "singtan/solvrays-finetuned-pdf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/singtan/solvrays-finetuned-pdf
- SGLang
How to use singtan/solvrays-finetuned-pdf 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 "singtan/solvrays-finetuned-pdf" \ --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": "singtan/solvrays-finetuned-pdf", "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 "singtan/solvrays-finetuned-pdf" \ --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": "singtan/solvrays-finetuned-pdf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use singtan/solvrays-finetuned-pdf with Docker Model Runner:
docker model run hf.co/singtan/solvrays-finetuned-pdf
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,44 +1,69 @@
|
|
| 1 |
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
library_name: transformers
|
| 4 |
-
base_model: google/gemma-2b
|
| 5 |
-
tags:
|
| 6 |
-
- text-generation
|
| 7 |
-
- standalone
|
| 8 |
-
- merged-weights
|
| 9 |
-
- pdf-optimized
|
| 10 |
-
- gemma
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
|
| 24 |
-
|
| 25 |
-
```
|
| 26 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 27 |
-
import torch
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
outputs = model.generate(**inputs, max_new_tokens=150)
|
| 36 |
-
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 37 |
-
```
|
| 38 |
|
| 39 |
-
##
|
| 40 |
-
|
| 41 |
-
- **Optimized for**: Technical documentation and PDF-source data.
|
| 42 |
|
| 43 |
-
|
| 44 |
-
Fine-tuned and Merged by
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
base_model: google/gemma-2b
|
| 5 |
+
tags:
|
| 6 |
+
- text-generation
|
| 7 |
+
- standalone
|
| 8 |
+
- merged-weights
|
| 9 |
+
- pdf-optimized
|
| 10 |
+
- gemma
|
| 11 |
+
- vision-guided-training
|
| 12 |
+
language:
|
| 13 |
+
- en
|
| 14 |
+
pipeline_tag: text-generation
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# ๐ Solvrays Finetuned Pdf (Standalone Merged Weight)
|
| 18 |
+
|
| 19 |
+
## ๐ Overview
|
| 20 |
+
This model is a high-performance, standalone version of **Gemma 2B**, meticulously fine-tuned for **complex document understanding and technical metadata extraction**. Unlike standard PEFT adapters, this version features **merged weights**, enabling seamless integration into production pipelines without the overhead of loading separate adapter layers.
|
| 21 |
+
|
| 22 |
+
### ๐ Key Features
|
| 23 |
+
- **Zero-Overhead Inference**: Merged weights allow loading as a native CausalLM.
|
| 24 |
+
- **Document Intelligence**: Fine-tuned on technical PDF structures, including infrastructure guides and architectural documentation.
|
| 25 |
+
- **Vision-Guided Data Pipeline**: Trained on text recovered through a hybrid Digital/OCR pipeline for maximum data fidelity.
|
| 26 |
+
- **Optimized Context**: Tailored for high-precision extraction and summary tasks from technical corpora.
|
| 27 |
+
|
| 28 |
+
## ๐ป Quick Start (Inference)
|
| 29 |
+
You can deploy this model using standard Hugging Face `transformers` logic.
|
| 30 |
+
|
| 31 |
+
```python
|
| 32 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 33 |
+
import torch
|
| 34 |
|
| 35 |
+
model_id = "singtan/solvrays-finetuned-pdf"
|
| 36 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 37 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 38 |
+
model_id,
|
| 39 |
+
device_map="auto",
|
| 40 |
+
torch_dtype=torch.float16,
|
| 41 |
+
trust_remote_code=True
|
| 42 |
+
)
|
| 43 |
|
| 44 |
+
prompt = "Analyze the provided technical documentation and summarize the key infrastructure recommendations."
|
| 45 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 46 |
|
| 47 |
+
with torch.no_grad():
|
| 48 |
+
outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7, top_p=0.9)
|
| 49 |
|
| 50 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 51 |
+
```
|
|
|
|
|
|
|
| 52 |
|
| 53 |
+
## ๐ Training Specifications
|
| 54 |
+
- **Base Model**: google/gemma-2b
|
| 55 |
+
- **Training Strategy**: QLoRA (4-bit quantization) followed by FP16 weight merging.
|
| 56 |
+
- **Final Loss Performance**: N/A
|
| 57 |
+
- **Learning Rate**: 0.0001
|
| 58 |
+
- **Epochs**: 3
|
| 59 |
+
- **Hardware**: Optimized for NVIDIA L4/V100/H100 environments.
|
| 60 |
|
| 61 |
+
## โ ๏ธ Limitations & Bias
|
| 62 |
+
While optimized for technical documentation, this model remains a generative LLM and may produce hallucinations if the input context is missing or highly ambiguous. It is recommended to use **Retrieval-Augmented Generation (RAG)** or **strict prompting** for mission-critical data extraction.
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
+
## ๐ License
|
| 65 |
+
This model follows the **Apache-2.0** license. Usage must adhere to the Google Gemma Prohibited Use Policy.
|
|
|
|
| 66 |
|
| 67 |
+
---
|
| 68 |
+
**Fine-tuned and Merged by Bibek Lama Singtan**
|
| 69 |
+
|