Instructions to use Intelligent-Internet/II-Search-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Intelligent-Internet/II-Search-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Intelligent-Internet/II-Search-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Intelligent-Internet/II-Search-4B") model = AutoModelForCausalLM.from_pretrained("Intelligent-Internet/II-Search-4B") 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Intelligent-Internet/II-Search-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Intelligent-Internet/II-Search-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Intelligent-Internet/II-Search-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Intelligent-Internet/II-Search-4B
- SGLang
How to use Intelligent-Internet/II-Search-4B 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 "Intelligent-Internet/II-Search-4B" \ --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": "Intelligent-Internet/II-Search-4B", "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 "Intelligent-Internet/II-Search-4B" \ --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": "Intelligent-Internet/II-Search-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Intelligent-Internet/II-Search-4B with Docker Model Runner:
docker model run hf.co/Intelligent-Internet/II-Search-4B
Update README.md
Browse files
README.md
CHANGED
|
@@ -79,13 +79,21 @@ II-Search-4B is designed for:
|
|
| 79 |
- Educational and research applications requiring factual accuracy
|
| 80 |
|
| 81 |
## Usage
|
| 82 |
-
|
|
|
|
|
|
|
| 83 |
```bash
|
| 84 |
vllm serve Intelligent-Internet/II-Search-4B --served-model-name II-Search-4B --tensor-parallel-size 8 --enable-reasoning --reasoning-parser deepseek_r1 --rope-scaling '{"rope_type":"yarn","factor":1.5,"original_max_position_embeddings":98304}' --max-model-len 131072
|
| 85 |
```
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
-
##
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
```python
|
| 91 |
generate_cfg = {
|
|
@@ -95,7 +103,6 @@ generate_cfg = {
|
|
| 95 |
'repetition_penalty': 1.1,
|
| 96 |
'max_tokens': 2048
|
| 97 |
}
|
| 98 |
-
|
| 99 |
```
|
| 100 |
|
| 101 |
- For a query that you need to find a short and accurate answer. Add the following phrase: "\n\nPlease reason step-by-step and put the final answer within \\boxed{}."
|
|
|
|
| 79 |
- Educational and research applications requiring factual accuracy
|
| 80 |
|
| 81 |
## Usage
|
| 82 |
+
To deploy and interact with the II-Search-4B model effectively, follow these options:
|
| 83 |
+
1. Serve the model using vLLM or SGLang
|
| 84 |
+
Use the following command to serve the model with vLLM (adjust parameters as needed for your hardware setup):
|
| 85 |
```bash
|
| 86 |
vllm serve Intelligent-Internet/II-Search-4B --served-model-name II-Search-4B --tensor-parallel-size 8 --enable-reasoning --reasoning-parser deepseek_r1 --rope-scaling '{"rope_type":"yarn","factor":1.5,"original_max_position_embeddings":98304}' --max-model-len 131072
|
| 87 |
```
|
| 88 |
+
This configuration enables distributed tensor parallelism across 8 GPUs, reasoning capabilities, custom RoPE scaling for extended context, and a maximum context length of 131,072 tokens.
|
| 89 |
+
|
| 90 |
+
2. Integrate web_search and web_visit tools
|
| 91 |
+
Equip the served model with web_search and web_visit tools to enable internet-aware functionality. Alternatively, use a middleware like MCP for tool integration—see this example repository: https://github.com/hoanganhpham1006/mcp-server-template.
|
| 92 |
|
| 93 |
+
## Host on macOS with MLX for local use
|
| 94 |
+
As an alternative for Apple Silicon users, host the quantized [II-Search-4B-MLX](https://huggingface.co/Intelligent-Internet/II-Search-4B-MLX) version on your Mac. Then, interact with it via user-friendly interfaces like LM Studio or Ollama Desktop.
|
| 95 |
+
|
| 96 |
+
## Recommended Generation Parameters
|
| 97 |
|
| 98 |
```python
|
| 99 |
generate_cfg = {
|
|
|
|
| 103 |
'repetition_penalty': 1.1,
|
| 104 |
'max_tokens': 2048
|
| 105 |
}
|
|
|
|
| 106 |
```
|
| 107 |
|
| 108 |
- For a query that you need to find a short and accurate answer. Add the following phrase: "\n\nPlease reason step-by-step and put the final answer within \\boxed{}."
|