Instructions to use cris177/Phi3.1-Simple-Arguments with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cris177/Phi3.1-Simple-Arguments with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cris177/Phi3.1-Simple-Arguments") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("cris177/Phi3.1-Simple-Arguments") model = AutoModelForCausalLM.from_pretrained("cris177/Phi3.1-Simple-Arguments") 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]:])) - llama-cpp-python
How to use cris177/Phi3.1-Simple-Arguments with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="cris177/Phi3.1-Simple-Arguments", filename="Phi3.1_simple_arguments.Q5_K_S.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use cris177/Phi3.1-Simple-Arguments with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf cris177/Phi3.1-Simple-Arguments:Q5_K_S # Run inference directly in the terminal: llama cli -hf cris177/Phi3.1-Simple-Arguments:Q5_K_S
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf cris177/Phi3.1-Simple-Arguments:Q5_K_S # Run inference directly in the terminal: llama cli -hf cris177/Phi3.1-Simple-Arguments:Q5_K_S
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 cris177/Phi3.1-Simple-Arguments:Q5_K_S # Run inference directly in the terminal: ./llama-cli -hf cris177/Phi3.1-Simple-Arguments:Q5_K_S
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 cris177/Phi3.1-Simple-Arguments:Q5_K_S # Run inference directly in the terminal: ./build/bin/llama-cli -hf cris177/Phi3.1-Simple-Arguments:Q5_K_S
Use Docker
docker model run hf.co/cris177/Phi3.1-Simple-Arguments:Q5_K_S
- LM Studio
- Jan
- vLLM
How to use cris177/Phi3.1-Simple-Arguments with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cris177/Phi3.1-Simple-Arguments" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cris177/Phi3.1-Simple-Arguments", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cris177/Phi3.1-Simple-Arguments:Q5_K_S
- SGLang
How to use cris177/Phi3.1-Simple-Arguments 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 "cris177/Phi3.1-Simple-Arguments" \ --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": "cris177/Phi3.1-Simple-Arguments", "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 "cris177/Phi3.1-Simple-Arguments" \ --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": "cris177/Phi3.1-Simple-Arguments", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use cris177/Phi3.1-Simple-Arguments with Ollama:
ollama run hf.co/cris177/Phi3.1-Simple-Arguments:Q5_K_S
- Unsloth Studio
How to use cris177/Phi3.1-Simple-Arguments 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 cris177/Phi3.1-Simple-Arguments 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 cris177/Phi3.1-Simple-Arguments to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for cris177/Phi3.1-Simple-Arguments to start chatting
- Atomic Chat new
- Docker Model Runner
How to use cris177/Phi3.1-Simple-Arguments with Docker Model Runner:
docker model run hf.co/cris177/Phi3.1-Simple-Arguments:Q5_K_S
- Lemonade
How to use cris177/Phi3.1-Simple-Arguments with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull cris177/Phi3.1-Simple-Arguments:Q5_K_S
Run and chat with the model
lemonade run user.Phi3.1-Simple-Arguments-Q5_K_S
List all available models
lemonade list
llm.create_chat_completion(
messages = [
{
"role": "user",
"content": "What is the capital of France?"
}
]
)Phi3.1 Simple Arguments
This model aims to parse simple english arguments, arguments formed of two premises and a conclusion, including two propositions.
Model Details
Model Description
- Developed by: Cristian Desivo
- Model type: LLM
- Language(s) (NLP): English
- License: Apache-2.0
- Finetuned from model: Phi3.1-mini
Model Sources
- Repository: TBD
- Demo: TBD
Quantization
Usage
Below we share some code snippets on how to get quickly started with running the model.
llama.cpp server [Recommended]
The recommended way of running the model is with a llama.cpp server running the quantized
Then you can use the following script to use the server's model for inference:
import json
import requests
def llmCall(messages, **args):
url = "http://localhost:8080/v1/chat/completions"
headers = {
"Content-Type": "application/json"
}
data = {
'messages': messages
}
for arg in args:
data[arg] = args[arg]
response = requests.post(url, headers=headers, json=data)
return response.json()
def analyze_argument(argument):
instruction = "Based on the following argument, identify the following elements: premises, conclusion, propositions, type of argument, negation of propositions and validity."
inputText = "### Input:\n" + argument
prompt = f"""{instruction}
{inputText}
"""
messages=[{"role":"user", "content":prompt}]
properties = {
"Premise 1": {"type": "string"},
"Premise 2": {"type": "string"},
"Conclusion": {"type": "string"},
"Type of argument": {"type": "string"},
"Proposition 1": {"type": "string"},
"Proposition 2": {"type": "string"},
"Negation of Proposition 1": {"type": "string"},
"Negation of Proposition 2": {"type": "string"},
"Validity": {"type": "string"},
}
analysis = llmCall(
messages=messages,
max_tokens=1000,
temperature=0,
stop=["<|end|>"],
response_format={
"type": "json_object",
"schema": {
"type": "object",
"properties": properties,
"required": list(properties.keys()),
},
}
)['choices'][0]['message']['content']
if analysis.endswith("<|end|>"):
analysis = analysis[:-5]
return analysis
argument = "If it's wednesday it's cold, and it's cold, therefore it's wednesday."
output = analyze_argument("If it's wednesday it's cold, and it's cold, therefore it's wednesday.")
print(output)
Output:
{"Premise 1": "If it's wednesday it's cold",
"Premise 2": "It's cold",
"Conclusion": "It is Wednesday",
"Proposition 1": "It is Wednesday",
"Proposition 2": "It is cold",
"Type of argument": "affirming the consequent",
"Negation of Proposition 1": "It is not Wednesday",
"Negation of Proposition 2": "It is not cold",
"Validity": true}
transformers ๐ค
First make sure to pip install -U transformers, then use the code below replacing the argument variable for the argument you want to parse:
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("cris177/Phi3.1-Simple-Arguments",
device_map="auto",)
tokenizer = AutoTokenizer.from_pretrained("cris177/Phi3.1-Simple-Arguments")
argument = "If it's wednesday it's cold, and it's cold, therefore it's wednesday."
instruction = 'Based on the following argument, identify the following elements: premises, conclusion, propositions, type of argument, negation of propositions and validity.'
alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
{}
### Input:
{}
### Response:"""
prompt = alpaca_prompt.format(instruction, argument)
input_ids = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**input_ids, max_length=1000, num_return_sequences=1)
print(tokenizer.decode(outputs[0]))
Output:
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Based on the following argument, identify the following elements: premises, conclusion, propositions, type of argument, negation of propositions and validity.
### Input:
If it's wednesday it's cold, and it's cold, therefore it's wednesday.
### Response:
{"Premise 1": "If it's wednesday it's cold",
"Premise 2": "It's cold",
"Conclusion": "It is Wednesday",
"Proposition 1": "It is Wednesday",
"Proposition 2": "It is cold",
"Type of argument": "affirming the consequent",
"Negation of Proposition 1": "It is not Wednesday",
"Negation of Proposition 2": "It is not cold",
"Validity": "false"}<|endoftext|>
Training Details
Training Data
The model was trained on syntethic data, based on the following types of arguments:
- Modus Ponen
- Modus Tollen
- Affirming Consequent
- Disjunctive Syllogism
- Denying Antecedent
- Invalid Conditional Syllogism
Each argument was constructed by selecting two random propositions (from a list of 400 propositions that was generated beforehand), choosing a type of argument and combining it all with randomly selected connectors (therefore, since, hence, thus, etc).
50k arguments were created to train the model, and 100 to test.
Training Procedure
Training
We used unsloth for memory reduced sped up training.
We trained for one epoch.
Less than 3.5 GB of VRAM were used for training, and it took 3 hours.
Evaluation
The model obtains 100% train and test accuracy on our synthetic dataset.
- Downloads last month
- 19
Evaluation results
- Accuracy on Argument-parsingself-reported100.000


# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="cris177/Phi3.1-Simple-Arguments", filename="Phi3.1_simple_arguments.Q5_K_S.gguf", )