# canifinetune

A command-line tool that estimates whether a Hugging Face model will fit and fine-tune on a given consumer GPU, and recommends batch size, sequence length, LoRA rank and quantization before any weights are downloaded.

canifinetune estimates, benchmarks and generates fine-tuning recipes for large language models on consumer GPUs. Before downloading a model's weights, it answers whether a given model can be fine-tuned with LoRA or QLoRA on a specific card, roughly how much VRAM the job will use, and what batch size, sequence length, LoRA rank and quantization setting to use, along with a ready-to-run Hugging Face, PEFT and TRL training script for that configuration.

Its estimates account for parts that simpler calculators miss, such as the memory used by the logits and cross-entropy computation over a large vocabulary, and the fp32 upcast that quantized training applies to embeddings and normalization layers. Coefficients are fitted against measured GPU memory peaks, and a bench and calibrate command can ground the estimate against a user's own hardware instead of the published baseline.

It is a Python package with a command-line interface, with optional extras for training, reporting and development.

Website: https://github.com/DaoyuanLi2816/can-i-finetune-this
