Text Generation
PEFT
Safetensors
Transformers
English
llama
lora
sft
trl
unsloth
conversational
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use Breakintelligence/Thinkmini with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Breakintelligence/Thinkmini with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/llama-3.2-1b-instruct-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "Breakintelligence/Thinkmini") - Transformers
How to use Breakintelligence/Thinkmini with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Breakintelligence/Thinkmini") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Breakintelligence/Thinkmini") model = AutoModelForCausalLM.from_pretrained("Breakintelligence/Thinkmini", device_map="auto") 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 Breakintelligence/Thinkmini with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Breakintelligence/Thinkmini" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Breakintelligence/Thinkmini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Breakintelligence/Thinkmini
- SGLang
How to use Breakintelligence/Thinkmini 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 "Breakintelligence/Thinkmini" \ --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": "Breakintelligence/Thinkmini", "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 "Breakintelligence/Thinkmini" \ --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": "Breakintelligence/Thinkmini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use Breakintelligence/Thinkmini 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 Breakintelligence/Thinkmini 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 Breakintelligence/Thinkmini to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Breakintelligence/Thinkmini to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="Breakintelligence/Thinkmini", max_seq_length=2048, ) - Docker Model Runner
How to use Breakintelligence/Thinkmini with Docker Model Runner:
docker model run hf.co/Breakintelligence/Thinkmini
Update README.md
Browse files
README.md
CHANGED
|
@@ -28,4 +28,42 @@ language:
|
|
| 28 |
|
| 29 |
### Framework versions
|
| 30 |
|
| 31 |
-
- PEFT 0.17.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
### Framework versions
|
| 30 |
|
| 31 |
+
- PEFT 0.17.1
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
### Inference Code
|
| 35 |
+
|
| 36 |
+
```python
|
| 37 |
+
import torch
|
| 38 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
| 39 |
+
|
| 40 |
+
model_name = "Prachir-AI/Thinkmini"
|
| 41 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 42 |
+
|
| 43 |
+
# Create a BitsAndBytesConfig to enable 4-bit loading
|
| 44 |
+
bnb_config = BitsAndBytesConfig(
|
| 45 |
+
load_in_4bit=True, # Enable 4-bit loading as intended for this model
|
| 46 |
+
bnb_4bit_quant_type="nf4", # This is a common default for 4-bit models
|
| 47 |
+
bnb_4bit_compute_dtype=torch.bfloat16, # Use bfloat16 for computation
|
| 48 |
+
bnb_4bit_use_double_quant=True, # Often used with nf4
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
# Load the model with the configured 4-bit quantization
|
| 52 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 53 |
+
model_name,
|
| 54 |
+
quantization_config=bnb_config,
|
| 55 |
+
torch_dtype=torch.bfloat16 # Ensure the model itself is loaded with bfloat16 dtypes where applicable
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
inputs = tokenizer("How do you plan for a full pentest of a web application?", return_tensors="pt").to('cuda')
|
| 59 |
+
# inference mode
|
| 60 |
+
|
| 61 |
+
output_ids = model.generate(
|
| 62 |
+
**inputs,
|
| 63 |
+
max_new_tokens=500,
|
| 64 |
+
temperature=0.7,
|
| 65 |
+
top_p=0.9
|
| 66 |
+
)
|
| 67 |
+
|
| 68 |
+
print(tokenizer.decode(output_ids[0], skip_special_tokens=True))
|
| 69 |
+
```
|