Instructions to use l3lab/ntpctx-llama3-8b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use l3lab/ntpctx-llama3-8b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="l3lab/ntpctx-llama3-8b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("l3lab/ntpctx-llama3-8b") model = AutoModelForMultimodalLM.from_pretrained("l3lab/ntpctx-llama3-8b") 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 Settings
- vLLM
How to use l3lab/ntpctx-llama3-8b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "l3lab/ntpctx-llama3-8b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "l3lab/ntpctx-llama3-8b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/l3lab/ntpctx-llama3-8b
- SGLang
How to use l3lab/ntpctx-llama3-8b 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 "l3lab/ntpctx-llama3-8b" \ --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": "l3lab/ntpctx-llama3-8b", "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 "l3lab/ntpctx-llama3-8b" \ --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": "l3lab/ntpctx-llama3-8b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use l3lab/ntpctx-llama3-8b with Docker Model Runner:
docker model run hf.co/l3lab/ntpctx-llama3-8b
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model: meta-llama/Meta-Llama-3-8B
|
| 4 |
+
---
|
| 5 |
+
## [miniCTX: Neural Theorem Proving with (Long-)Contexts]()
|
| 6 |
+
File-tuned context model based on [miniCTX: Neural Theorem Proving with
|
| 7 |
+
(Long-)Contexts](https://www.arxiv.org/abs/2408.03350).
|
| 8 |
+
|
| 9 |
+
- Base language model: Llama 3 8B
|
| 10 |
+
- Data: [ntp-mathlib-instruct-context](https://huggingface.co/datasets/l3lab/ntp-mathlib-instruct-context)
|
| 11 |
+
|
| 12 |
+
It is specifically finetuned for Lean 4 tactic prediction given proof states and optional file contexts.
|
| 13 |
+
|
| 14 |
+
#### Example input
|
| 15 |
+
```
|
| 16 |
+
/- You are proving a theorem in Lean 4.
|
| 17 |
+
You are given the following information:
|
| 18 |
+
- The file contents up to the current tactic, inside [CTX]...[/CTX]
|
| 19 |
+
- The current proof state, inside [STATE]...[/STATE]
|
| 20 |
+
|
| 21 |
+
Your task is to generate the next tactic in the proof.
|
| 22 |
+
Put the next tactic inside [TAC]...[/TAC]
|
| 23 |
+
-/
|
| 24 |
+
[CTX]
|
| 25 |
+
import Mathlib.Data.Nat.Prime
|
| 26 |
+
|
| 27 |
+
theorem test_thm (m n : Nat) (h : m.Coprime n) : m.gcd n = 1 := by
|
| 28 |
+
|
| 29 |
+
[/CTX]
|
| 30 |
+
[STATE]
|
| 31 |
+
m n : ℕ
|
| 32 |
+
h : Nat.Coprime m n
|
| 33 |
+
⊢ Nat.gcd m n = 1
|
| 34 |
+
[/STATE]
|
| 35 |
+
[TAC]
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
#### Example output
|
| 39 |
+
```
|
| 40 |
+
rw [Nat.Coprime] at h
|
| 41 |
+
[/TAC]
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
#### Citation
|
| 45 |
+
|
| 46 |
+
Please cite:
|
| 47 |
+
```
|
| 48 |
+
@misc{hu2024minictx,
|
| 49 |
+
author = {Jiewen Hu and Thomas Zhu and Sean Welleck},
|
| 50 |
+
title = {miniCTX: Neural Theorem Proving with (Long-)Contexts},
|
| 51 |
+
year = {2024},
|
| 52 |
+
eprint={2408.03350},
|
| 53 |
+
archivePrefix={arXiv},
|
| 54 |
+
}
|
| 55 |
+
```
|