Instructions to use ykarout/phi-4-deepseek-reasoning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ykarout/phi-4-deepseek-reasoning with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ykarout/phi-4-deepseek-reasoning") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ykarout/phi-4-deepseek-reasoning") model = AutoModelForCausalLM.from_pretrained("ykarout/phi-4-deepseek-reasoning", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ykarout/phi-4-deepseek-reasoning with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ykarout/phi-4-deepseek-reasoning" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ykarout/phi-4-deepseek-reasoning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ykarout/phi-4-deepseek-reasoning
- SGLang
How to use ykarout/phi-4-deepseek-reasoning 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 "ykarout/phi-4-deepseek-reasoning" \ --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": "ykarout/phi-4-deepseek-reasoning", "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 "ykarout/phi-4-deepseek-reasoning" \ --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": "ykarout/phi-4-deepseek-reasoning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use ykarout/phi-4-deepseek-reasoning with Docker Model Runner:
docker model run hf.co/ykarout/phi-4-deepseek-reasoning
|
Download README.md from ykarout/phi-4-deepseek-reasoning: direct link, hf CLI and curl.
- Browser
- Download file 8.77 kB
-
https://huggingface.co/ykarout/phi-4-deepseek-reasoning/resolve/main/README.md
- Command line
-
hf download hf://ykarout/phi-4-deepseek-reasoning/README.md
-
curl -L -o README.md https://huggingface.co/ykarout/phi-4-deepseek-reasoning/resolve/main/README.md
8.77 kB
| library_name: transformers | |
| tags: | |
| - unsloth | |
| license: apache-2.0 | |
| datasets: | |
| - nvidia/Llama-Nemotron-Post-Training-Dataset | |
| base_model: | |
| - unsloth/phi-4 | |
| - deepseek-ai/DeepSeek-R1 | |
| pipeline_tag: text-generation | |
| # Model Card for Model ID | |
| Phi-4 trained on reasoning outputs on complex logic, math and coding challenges derived from nvidia/Llama-Nemotron-Post-Training-Dataset filtered to include high length reasoning answers generated by DeepSeek R1. | |
| ## Model Details | |
| ### Model Description | |
| Phi-4 trained on reasoning outputs on complex logic, math and coding challenges derived from nvidia/Llama-Nemotron-Post-Training-Dataset filtered to include high length reasoning answers generated by DeepSeek R1. | |
| The training was on 10,000 samples done on an RTX 5090 (yes managed to make unsloth work on a 5090) with context length of 16384 and took around 10 hours using unsloth 4-bit quants and transfomers SFT Trainer. | |
| You do not need to add a system prompt but it can help in some use cases. The model will automatically go into thinking mode when presented with complex tasks. | |
| Recommended Settings of temperature = 1.5 (you can test with 1 to 1.5) , min_p = 0.1, repeat penalty 1.2 or 1.3 to mitigate extremely long reasoning around the same concept. | |
| Try the following prompt or similar structured prompts containing complex connections and the model will automatically go into thinking mode and generate long reasoning chains akin to DeepSeek. | |
| #### Prompt: | |
| This prompt was generated using Claude 3.7 Sonnet and not included in the train or test dataset, use similarly structred prompts and see the magic! | |
| 1. Network Packet Routing Optimization Challenge | |
| You're designing a system to optimize packet routing in a network with multiple possible paths. The network consists of nodes connected by bidirectional links, each with different bandwidth capacities and latency values. | |
| Your task is to find the most efficient routing path between a given source and destination node that satisfies specific constraints on bandwidth, latency, and hop count. | |
| Input Specification | |
| The first line contains four space-separated integers: `n`, `m`, `b_min`, and `l_max` (2 ≤ n ≤ 100, 1 ≤ m ≤ 5000, 1 ≤ b_min ≤ 1000, 1 ≤ l_max ≤ 10000) | |
| - `n`: number of nodes in the network (numbered from 1 to n) | |
| - `m`: number of links between nodes | |
| - `b_min`: minimum required bandwidth for the path | |
| - `l_max`: maximum allowed total latency for the path | |
| The next `m` lines each contain four integers `u`, `v`, `b`, `l` (1 ≤ u, v ≤ n, u ≠ v, 1 ≤ b ≤ 1000, 1 ≤ l ≤ 1000): | |
| - `u`, `v`: nodes connected by this link | |
| - `b`: bandwidth capacity of the link | |
| - `l`: latency of the link | |
| The last line contains two integers `s` and `t` (1 ≤ s, t ≤ n, s ≠ t) - the source and destination nodes. | |
| Constraints and Notes | |
| 1. The bandwidth of a path is the minimum bandwidth among all links in the path | |
| 2. The latency of a path is the sum of latencies of all links in the path | |
| 3. A valid path must have bandwidth ≥ `b_min` and latency ≤ `l_max` | |
| 4. Among all valid paths, you must choose the one with the highest bandwidth | |
| 5. If there are multiple paths with the same highest bandwidth, choose the one with the lowest latency | |
| 6. If there are still multiple paths, choose the one with the fewest hops (links) | |
| 7. If no valid path exists, output "NO PATH" | |
| Output | |
| If a valid path exists, the first line should contain three space-separated integers: the bandwidth of the chosen path, the total latency of the chosen path, and the number of hops. | |
| The second line should contain the sequence of nodes in the path, starting with `s` and ending with `t`. | |
| If no valid path exists, output "NO PATH" (without quotes). | |
| Examples | |
| Example 1: | |
| ``` | |
| 5 6 50 100 | |
| 1 2 100 20 | |
| 2 3 80 30 | |
| 3 5 70 10 | |
| 1 4 60 10 | |
| 4 5 90 30 | |
| 1 3 50 5 | |
| 1 5 | |
| ``` | |
| Output: | |
| ``` | |
| 70 60 3 | |
| 1 2 3 5 | |
| ``` | |
| Example 2: | |
| ``` | |
| 4 5 80 50 | |
| 1 2 80 20 | |
| 2 3 120 15 | |
| 3 4 90 10 | |
| 1 3 100 30 | |
| 2 4 70 25 | |
| 1 4 | |
| ``` | |
| Output: | |
| ``` | |
| 90 40 2 | |
| 1 3 4 | |
| ``` | |
| Example 3: | |
| ``` | |
| 3 3 100 100 | |
| 1 2 150 40 | |
| 2 3 180 70 | |
| 1 3 120 30 | |
| 1 3 | |
| ``` | |
| Output: | |
| ``` | |
| 120 30 1 | |
| 1 3 | |
| ``` | |
| Your solution should efficiently find the optimal path that satisfies all constraints, handling potentially complex network topologies with multiple possible routes between source and destination. | |
| - **Developed by:** [More Information Needed] | |
| - **Funded by [optional]:** [More Information Needed] | |
| - **Shared by [optional]:** [More Information Needed] | |
| - **Model type:** [More Information Needed] | |
| - **Language(s) (NLP):** [More Information Needed] | |
| - **License:** [More Information Needed] | |
| - **Finetuned from model [optional]:**unsloth/phi-4 | |
| ## Uses | |
| Complex reasoning requiring challenging thinking and coding (mostly python). | |
| ### Direct Use | |
| <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. --> | |
| [More Information Needed] | |
| ### Downstream Use [optional] | |
| <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app --> | |
| [More Information Needed] | |
| ### Out-of-Scope Use | |
| <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. --> | |
| [More Information Needed] | |
| ## Bias, Risks, and Limitations | |
| <!-- This section is meant to convey both technical and sociotechnical limitations. --> | |
| [More Information Needed] | |
| ### Recommendations | |
| <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. --> | |
| Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations. | |
| ## How to Get Started with the Model | |
| Use the code below to get started with the model. | |
| [More Information Needed] | |
| ## Training Details | |
| ### Training Data | |
| <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. --> | |
| [More Information Needed] | |
| ### Training Procedure | |
| <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. --> | |
| #### Preprocessing [optional] | |
| [More Information Needed] | |
| #### Training Hyperparameters | |
| - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision --> | |
| #### Speeds, Sizes, Times [optional] | |
| <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. --> | |
| [More Information Needed] | |
| ## Evaluation | |
| <!-- This section describes the evaluation protocols and provides the results. --> | |
| ### Testing Data, Factors & Metrics | |
| #### Testing Data | |
| <!-- This should link to a Dataset Card if possible. --> | |
| [More Information Needed] | |
| #### Factors | |
| <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. --> | |
| [More Information Needed] | |
| #### Metrics | |
| <!-- These are the evaluation metrics being used, ideally with a description of why. --> | |
| [More Information Needed] | |
| ### Results | |
| [More Information Needed] | |
| #### Summary | |
| ## Model Examination [optional] | |
| <!-- Relevant interpretability work for the model goes here --> | |
| [More Information Needed] | |
| ## Environmental Impact | |
| <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly --> | |
| Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700). | |
| - **Hardware Type:** [More Information Needed] | |
| - **Hours used:** [More Information Needed] | |
| - **Cloud Provider:** [More Information Needed] | |
| - **Compute Region:** [More Information Needed] | |
| - **Carbon Emitted:** [More Information Needed] | |
| ## Technical Specifications [optional] | |
| ### Model Architecture and Objective | |
| [More Information Needed] | |
| ### Compute Infrastructure | |
| [More Information Needed] | |
| #### Hardware | |
| [More Information Needed] | |
| #### Software | |
| [More Information Needed] | |
| ## Citation [optional] | |
| <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. --> | |
| **BibTeX:** | |
| [More Information Needed] | |
| **APA:** | |
| [More Information Needed] | |
| ## Glossary [optional] | |
| <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. --> | |
| [More Information Needed] | |
| ## More Information [optional] | |
| [More Information Needed] | |
| ## Model Card Authors [optional] | |
| [More Information Needed] | |
| ## Model Card Contact | |
| [More Information Needed] |