Instructions to use Threatthriver/phi4-finetuned-16bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Threatthriver/phi4-finetuned-16bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Threatthriver/phi4-finetuned-16bit") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Threatthriver/phi4-finetuned-16bit", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Threatthriver/phi4-finetuned-16bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Threatthriver/phi4-finetuned-16bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Threatthriver/phi4-finetuned-16bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Threatthriver/phi4-finetuned-16bit
- SGLang
How to use Threatthriver/phi4-finetuned-16bit 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 "Threatthriver/phi4-finetuned-16bit" \ --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": "Threatthriver/phi4-finetuned-16bit", "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 "Threatthriver/phi4-finetuned-16bit" \ --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": "Threatthriver/phi4-finetuned-16bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use Threatthriver/phi4-finetuned-16bit 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 Threatthriver/phi4-finetuned-16bit 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 Threatthriver/phi4-finetuned-16bit to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Threatthriver/phi4-finetuned-16bit to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="Threatthriver/phi4-finetuned-16bit", max_seq_length=2048, ) - Docker Model Runner
How to use Threatthriver/phi4-finetuned-16bit with Docker Model Runner:
docker model run hf.co/Threatthriver/phi4-finetuned-16bit
Threatthriver/phi4-finetuned-16bit Model
Developed by: Threatthriver
License: Apache-2.0
Fine-tuned from model: unsloth/phi-4-unsloth-bnb-4bit (https://huggingface.co/unsloth/phi-4-unsloth-bnb-4bit)
Model Description:
This PHI-4 model, named Threatthriver/phi4-finetuned-16bit, was fine-tuned by Threatthriver, potentially for applications in cybersecurity, threat intelligence, or related domains. It was trained using Unsloth (https://github.com/unslothai/unsloth) and Hugging Face's TRL library, which allowed for a 2x faster training process. The model is based on the unsloth/phi-4-unsloth-bnb-4bit base model. It was fine-tuned and saved in 16-bit precision.
Intended Use:
This model is intended for research and development purposes. Specifically, it may be suitable for:
- Text generation related to cybersecurity topics.
- Experimentation with threat intelligence analysis.
- Applications involving security automation.
Please adapt this section based on the actual intended use of your model.
Training Details:
The model was fine-tuned using the Unsloth library, known for its efficiency in training large language models. The base model unsloth/phi-4-unsloth-bnb-4bit was initially quantized to 4-bit using bitsandbytes (bnb) for reduced memory footprint and faster training. This fine-tuned version, Threatthriver/phi4-finetuned-16bit, was then saved in 16-bit precision.
How to Use:
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Threatthriver/phi4-finetuned-16bit"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
input_text = "Example input text related to cybersecurity..."
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda") # If using GPU
outputs = model.generate(**input_ids)
print(tokenizer.decode(outputs[0]))
Replace input_text with your specific use case.
Disclaimer:
This model is provided as-is, and no guarantees are made regarding its performance or suitability for any specific task. Use it at your own risk.
Acknowledgements:
Trained 2x faster with Unsloth (https://github.com/unslothai/unsloth) and Huggingface's TRL library.