Text Generation
Transformers
Safetensors
GGUF
English
mistral
oil-gas
drilling-engineering
mathstral-7b
lora
fine-tuned
energy-ai
pragmatic-ai
text-generation-inference
conversational
Eval Results (legacy)
Instructions to use GainEnergy/OGAI-STEM-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use GainEnergy/OGAI-STEM-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="GainEnergy/OGAI-STEM-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("GainEnergy/OGAI-STEM-7B") model = AutoModelForCausalLM.from_pretrained("GainEnergy/OGAI-STEM-7B") 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
- vLLM
How to use GainEnergy/OGAI-STEM-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "GainEnergy/OGAI-STEM-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GainEnergy/OGAI-STEM-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/GainEnergy/OGAI-STEM-7B
- SGLang
How to use GainEnergy/OGAI-STEM-7B 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 "GainEnergy/OGAI-STEM-7B" \ --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": "GainEnergy/OGAI-STEM-7B", "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 "GainEnergy/OGAI-STEM-7B" \ --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": "GainEnergy/OGAI-STEM-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use GainEnergy/OGAI-STEM-7B with Docker Model Runner:
docker model run hf.co/GainEnergy/OGAI-STEM-7B
OGAI-STEM-7B: AI-Powered Engineering Model for Oil & Gas Calculations
Model Description
OGAI-STEM-7B is a LoRA fine-tuned Mathstral-7B model, designed specifically for oil and gas engineering, scientific computing, and technical problem-solving. It is optimized for numerical accuracy, complex engineering calculations, and technical document understanding.
The model is an integral part of GainEnergy's Upstrima AI Platform, enhancing workflows with pragmatic AI agents, scientific computing tools, and retrieval-augmented generation (RAG)-based document analysis.
Technical Architecture
Base Model Specifications
- Architecture: Mathstral-7B (Mistral fine-tuned for advanced math reasoning)
- Parameters: 7B
- Context Length: 32,768 tokens for long-form scientific queries
- Mathematical Precision: Enhanced for oil & gas engineering computations
Fine-tuning Approach
- Method: Low-Rank Adaptation (LoRA) with rank 64
- Training Dataset: 3.2M datapoints from specialized oil & gas engineering sources
- Hardware: Trained on 8x NVIDIA A100 80GB GPUs
- Training Time: 2,200 GPU hours
- Special Features: Improved accuracy in fluid mechanics, pressure drop, and geomechanics calculations
Performance Optimizations
- Quantization: 4-bit and 8-bit versions optimized for low-memory inference
- Inference Speed: Tuned KV cache management for real-time engineering computations
- Memory Footprint: Runs efficiently on 12GB VRAM with 4-bit quantization
- Reduced Hallucinations: Domain-specific fine-tuning minimizes incorrect scientific results
Deployment-Optimized Versions
| Version | Memory Requirement | Performance |
|---|---|---|
| OGAI-STEM-7B-GGUF | CPU optimized | Suitable for edge computing |
Local Deployment with vLLM
python -m vllm.entrypoints.openai.api_server \
--model GainEnergy/ogai-stem-7b \
--tensor-parallel-size 2
How to Use
Run Inference in Python
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "GainEnergy/ogai-stem-7b"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
prompt = "Calculate the pressure drop in a 500m pipeline with a 10,000 BPD flow rate."
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Citing OGAI-STEM-7B
@article{ogai_stem_7b_2025,
title={OGAI-STEM-7B: AI Model for Oil & Gas Scientific Computing},
author={GainEnergy AI Team},
year={2025},
publisher={Hugging Face Models}
}
- Downloads last month
- 9
Model tree for GainEnergy/OGAI-STEM-7B
Base model
mistralai/Mathstral-7B-v0.1Datasets used to train GainEnergy/OGAI-STEM-7B
Viewer • Updated • 450k • 36.7k • 749
unsloth/LaTeX_OCR
Viewer • Updated • 76.3k • 7.41k • 72
GainEnergy/oilandgas-engineering-dataset
Viewer • Updated • 453 • 52 • 5
Collection including GainEnergy/OGAI-STEM-7B
Evaluation results
- Engineering Calculations Accuracy on GainEnergy Oil & Gas Corpusself-reported94.500
- Scientific Computation Precision on GainEnergy Oil & Gas Corpusself-reported92.300
- Context Retention on GainEnergy Oil & Gas Corpusself-reportedHigh