Instructions to use sausheong/lexsg with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use sausheong/lexsg with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="sausheong/lexsg", filename="llama-3.1-8b-lexsg-q4_k_m.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use sausheong/lexsg with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf sausheong/lexsg:Q4_K_M # Run inference directly in the terminal: llama-cli -hf sausheong/lexsg:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf sausheong/lexsg:Q4_K_M # Run inference directly in the terminal: llama-cli -hf sausheong/lexsg: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 sausheong/lexsg:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf sausheong/lexsg: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 sausheong/lexsg:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf sausheong/lexsg:Q4_K_M
Use Docker
docker model run hf.co/sausheong/lexsg:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use sausheong/lexsg with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sausheong/lexsg" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sausheong/lexsg", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sausheong/lexsg:Q4_K_M
- Ollama
How to use sausheong/lexsg with Ollama:
ollama run hf.co/sausheong/lexsg:Q4_K_M
- Unsloth Studio new
How to use sausheong/lexsg 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 sausheong/lexsg 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 sausheong/lexsg to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for sausheong/lexsg to start chatting
- Pi new
How to use sausheong/lexsg with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf sausheong/lexsg:Q4_K_M
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": "sausheong/lexsg:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use sausheong/lexsg with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf sausheong/lexsg:Q4_K_M
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 sausheong/lexsg:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use sausheong/lexsg with Docker Model Runner:
docker model run hf.co/sausheong/lexsg:Q4_K_M
- Lemonade
How to use sausheong/lexsg with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull sausheong/lexsg:Q4_K_M
Run and chat with the model
lemonade run user.lexsg-Q4_K_M
List all available models
lemonade list
LexSG - Singapore Legal Assistant Model
A specialized AI assistant trained on Singapore statutes and subsidiary legislation, built on the Llama 3.1 8B Instruct architecture and optimized for legal text generation.
Model Details
Model Description
LexSG is a fine-tuned and quantized language model designed specifically to assist with Singapore legal matters. It provides accurate, contextual responses about Singapore's legal framework and helps users understand complex legal provisions.
- Developed by: Chang Sau Sheong
- Model type: Causal Language Model
- Language(s) (NLP): English
- License: Llama 3.1 License
- Finetuned from model: meta-llama/Meta-Llama-3.1-8B-Instruct
Model Sources
- Repository: (https://huggingface.co/sausheong/lexsg)
- Base Model: meta-llama/Meta-Llama-3.1-8B-Instruct
Uses
Direct Use
This model is intended for educational and informational purposes to help users understand Singapore legal provisions and statutes. It can be used to:
- Explain legal sections and provisions from Singapore acts
- Answer questions about Singapore's legal framework
- Provide context for legal documents
- Help interpret legal language and terminology
- Assist with understanding regulatory requirements
Downstream Use
The model can be integrated into legal research tools, educational platforms, or chatbot applications focused on Singapore law.
Out-of-Scope Use
- Not for legal advice: This model should not be used as a substitute for professional legal counsel
- Not for other jurisdictions: Specifically trained on Singapore law and may not be accurate for other legal systems
- Not for critical decisions: Should not be used for making important legal or business decisions without professional verification
Bias, Risks, and Limitations
- Training data limitations: Responses are based on training data and may not reflect the most recent legal changes
- Legislation only: Training data is Singapore statutes and subsidiary legislation only, without any Singapore legal cases
- Legal complexity: Legal interpretations can be highly context-dependent and nuanced
- Professional consultation required: Complex legal matters require consultation with qualified legal professionals
- Potential biases: May reflect biases present in legal training data
Recommendations
Users should be made aware of the risks, biases and limitations of the model. Always consult with qualified legal professionals for specific legal matters.
How to Get Started with the Model
llama.cpp/Ollama
The model file llama-3.1-8b-lexsg-q4_k_m.gguf is formatted in GGUF and can be used in any llama.cpp compatible library or application.
Specifically it has been tested in Ollama Ollama, with the given Modelfile
Running the Model
To use this with Ollama:
Build the model from the Modelfile:
ollama create lexsg -f Modelfileor even simpler just do this:
./setup_ollama_model.shRun the model:
ollama run lexsgStart asking questions about Singapore law:
> What does Section 73 of the Companies Act cover? > Explain the requirements for setting up a private limited company in Singapore > What are the penalties for non-compliance with PDPA?
Training Details
Training Data
The model was fine-tuned on Singapore legal documents and statutes, including but not limited to:
- Singapore Acts and Statutes
- Legal provisions and regulations
- Case law references
- Regulatory guidelines
Training Procedure
Training Hyperparameters
- Training regime: Fine-tuned from Llama 3.1 8B Instruct
- Quantization: Q4_K_M (4-bit quantized for efficient inference)
Speeds, Sizes, Times
- Model size: ~4.8GB (quantized)
- Context length: 4,096 tokens
- Max generation: 1,024 tokens
Technical Specifications
Model Architecture and Objective
- Architecture: Llama 3.1 transformer architecture
- Training objective: Causal language modeling
Hardware
- Memory requirements: ~6GB RAM recommended for inference
- Platform support: Cross-platform via Ollama
Inference parameters
The following are the inference parameters in the model file. You can change it accordingly.
- Temperature: 0.3 (conservative, factual responses)
- Top-p: 0.9 (nucleus sampling for quality)
- Top-k: 40 (controlled vocabulary selection)
- Repeat penalty: 1.1 (reduces repetition)
Model Card Authors
Chang Sau Sheong
More Information
For more details about Singapore legislation, refer to Singapore Statutes Online
Legal Disclaimer: This model is designed to provide general information about Singapore law and should not be considered as legal advice. For specific legal matters, always consult with a qualified legal professional licensed to practice in Singapore.
- Downloads last month
- 6
4-bit
Model tree for sausheong/lexsg
Base model
meta-llama/Llama-3.1-8B