Instructions to use samadpls/torchlight-phi4-mini-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use samadpls/torchlight-phi4-mini-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("microsoft/Phi-4-mini-instruct") model = PeftModel.from_pretrained(base_model, "samadpls/torchlight-phi4-mini-lora") - MLX
How to use samadpls/torchlight-phi4-mini-lora with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("samadpls/torchlight-phi4-mini-lora") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use samadpls/torchlight-phi4-mini-lora with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "samadpls/torchlight-phi4-mini-lora" --prompt "Once upon a time"
- Atomic Chat
Download mlx/adapter_config.json from samadpls/torchlight-phi4-mini-lora: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/samadpls/torchlight-phi4-mini-lora/resolve/main/mlx/adapter_config.json
- Command line
-
hf download hf://samadpls/torchlight-phi4-mini-lora/mlx/adapter_config.json
-
curl -L -o adapter_config.json https://huggingface.co/samadpls/torchlight-phi4-mini-lora/resolve/main/mlx/adapter_config.json
1.14 kB
| { | |
| "adapter_path": "data/train/phi4-mini/adapters", | |
| "batch_size": 2, | |
| "clear_cache_threshold": 0, | |
| "config": "data/train/phi4-mini/lora.yaml", | |
| "data": "data/train/phi4-mini/data", | |
| "fine_tune_type": "lora", | |
| "grad_accumulation_steps": 4, | |
| "grad_checkpoint": true, | |
| "iters": 3459, | |
| "learning_rate": 0.0002, | |
| "lora_parameters": { | |
| "rank": 16, | |
| "scale": 2.0, | |
| "dropout": 0.0 | |
| }, | |
| "lr_schedule": { | |
| "name": "cosine_decay", | |
| "warmup": 43, | |
| "arguments": [ | |
| 0.0002, | |
| 821, | |
| 0.0 | |
| ] | |
| }, | |
| "mask_prompt": true, | |
| "max_seq_length": 4096, | |
| "model": "microsoft/Phi-4-mini-instruct", | |
| "num_layers": 16, | |
| "optimizer": "adamw", | |
| "optimizer_config": { | |
| "adamw": { | |
| "weight_decay": 0.01 | |
| } | |
| }, | |
| "project_name": null, | |
| "report_to": null, | |
| "resume_adapter_file": null, | |
| "save_every": 1000, | |
| "seed": 0, | |
| "steps_per_eval": 1000, | |
| "steps_per_report": 10, | |
| "test": false, | |
| "test_batches": 500, | |
| "train": true, | |
| "trust_remote_code": false, | |
| "val_batches": -1 | |
| } |