Instructions to use principled-intelligence/claim-extraction with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use principled-intelligence/claim-extraction with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="principled-intelligence/claim-extraction") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("principled-intelligence/claim-extraction") model = AutoModelForCausalLM.from_pretrained("principled-intelligence/claim-extraction") 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 principled-intelligence/claim-extraction with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "principled-intelligence/claim-extraction" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "principled-intelligence/claim-extraction", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/principled-intelligence/claim-extraction
- SGLang
How to use principled-intelligence/claim-extraction 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 "principled-intelligence/claim-extraction" \ --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": "principled-intelligence/claim-extraction", "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 "principled-intelligence/claim-extraction" \ --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": "principled-intelligence/claim-extraction", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use principled-intelligence/claim-extraction with Docker Model Runner:
docker model run hf.co/principled-intelligence/claim-extraction
Upload ClaimExtractionPipeline
Browse files- claim_extractor.py +1 -7
claim_extractor.py
CHANGED
|
@@ -20,10 +20,8 @@ class ClaimExtractionPipeline(Pipeline):
|
|
| 20 |
tokenizer=None,
|
| 21 |
skip_evidences: bool = True,
|
| 22 |
max_new_tokens: int = 20_000,
|
| 23 |
-
do_sample: bool =
|
| 24 |
temperature: float = 0.7,
|
| 25 |
-
frequency_penalty: float = 0.0,
|
| 26 |
-
presence_penalty: float = 1.5,
|
| 27 |
repetition_penalty: float = 1.0,
|
| 28 |
top_p: float = 0.8,
|
| 29 |
top_k: int = 20,
|
|
@@ -51,8 +49,6 @@ class ClaimExtractionPipeline(Pipeline):
|
|
| 51 |
self.max_new_tokens = max_new_tokens
|
| 52 |
self.do_sample = do_sample
|
| 53 |
self.temperature = temperature
|
| 54 |
-
self.frequency_penalty = frequency_penalty
|
| 55 |
-
self.presence_penalty = presence_penalty
|
| 56 |
self.repetition_penalty = repetition_penalty
|
| 57 |
self.top_p = top_p
|
| 58 |
self.top_k = top_k
|
|
@@ -113,8 +109,6 @@ class ClaimExtractionPipeline(Pipeline):
|
|
| 113 |
max_new_tokens=self.max_new_tokens,
|
| 114 |
do_sample=self.do_sample,
|
| 115 |
temperature=self.temperature,
|
| 116 |
-
frequency_penalty=self.frequency_penalty,
|
| 117 |
-
presence_penalty=self.presence_penalty,
|
| 118 |
repetition_penalty=self.repetition_penalty,
|
| 119 |
top_p=self.top_p,
|
| 120 |
top_k=self.top_k,
|
|
|
|
| 20 |
tokenizer=None,
|
| 21 |
skip_evidences: bool = True,
|
| 22 |
max_new_tokens: int = 20_000,
|
| 23 |
+
do_sample: bool = True,
|
| 24 |
temperature: float = 0.7,
|
|
|
|
|
|
|
| 25 |
repetition_penalty: float = 1.0,
|
| 26 |
top_p: float = 0.8,
|
| 27 |
top_k: int = 20,
|
|
|
|
| 49 |
self.max_new_tokens = max_new_tokens
|
| 50 |
self.do_sample = do_sample
|
| 51 |
self.temperature = temperature
|
|
|
|
|
|
|
| 52 |
self.repetition_penalty = repetition_penalty
|
| 53 |
self.top_p = top_p
|
| 54 |
self.top_k = top_k
|
|
|
|
| 109 |
max_new_tokens=self.max_new_tokens,
|
| 110 |
do_sample=self.do_sample,
|
| 111 |
temperature=self.temperature,
|
|
|
|
|
|
|
| 112 |
repetition_penalty=self.repetition_penalty,
|
| 113 |
top_p=self.top_p,
|
| 114 |
top_k=self.top_k,
|