### Quick Start Installation and Setup Source: https://github.com/liquid4all/cookbook/blob/main/examples/localcowork/README.md Steps to clone the repository, set up development environment, download the LFM2-24B-A2B model, and start the model server and application. ```bash # 1. Clone and set up git clone && cd localCoWork ./scripts/setup-dev.sh # 2. Download LFM2-24B-A2B (~14 GB) # https://huggingface.co/LiquidAI/LFM2-24B-A2B-GGUF pip install huggingface-hub python3 -c " from huggingface_hub import hf_hub_download hf_hub_download('LiquidAI/LFM2-24B-A2B-GGUF', 'LFM2-24B-A2B-Q4_K_M.gguf', local_dir='$HOME/Projects/_models/') " # 3. Start the model server ./scripts/start-model.sh # 4. Launch the app (in another terminal) cargo tauri dev ``` -------------------------------- ### Quick Start Development Setup Source: https://github.com/liquid4all/cookbook/blob/main/examples/localcowork/CONTRIBUTING.md Steps to clone the repository, set up the development environment, verify the setup, and start the application in development mode. ```bash # 1. Fork and clone git clone && cd localCoWork # 2. Run setup (installs all deps, creates venvs, checks prereqs) ./scripts/setup-dev.sh # 3. Verify everything works ./scripts/smoke-test.sh # 4. Start the app in dev mode cargo tauri dev ``` -------------------------------- ### Install and Authenticate Modal CLI Source: https://github.com/liquid4all/cookbook/blob/main/examples/voice-chat/README.md Installs the Modal CLI using uv and then authenticates the user with the Modal service. ```bash uv add modal uv run modal token new ``` -------------------------------- ### Inference Setup Source: https://github.com/liquid4all/cookbook/blob/main/finetuning/notebooks/sft_for_vision_language_model.ipynb Sets up the model for inference and prepares inputs for the first example. ```python FastVisionModel.for_inference(model) # Enable for inference! image = dataset[2]["image"] instruction = "Write the LaTeX representation for this image." messages = [ {"role": "user", "content": [ {"type": "image"}, {"type": "text", "text": instruction} ]} ] input_text = tokenizer.apply_chat_template(messages, add_generation_prompt = True) inputs = tokenizer( image, input_text, add_special_tokens = False, return_tensors = "pt", ).to("cuda") from transformers import TextStreamer text_streamer = TextStreamer(tokenizer, skip_prompt = True) _ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 128, use_cache = True, temperature = 1.5, min_p = 0.1) ``` -------------------------------- ### Setup Dependencies Source: https://github.com/liquid4all/cookbook/blob/main/examples/local-coding-assistant/README.md Clones the project, installs dependencies using uv, and sets up the environment file with an API key. ```bash cd examples/local-coding-assistant uv sync cp .env.example .env # Edit .env and set ANTHROPIC_API_KEY ``` -------------------------------- ### Initial Setup and Installation Source: https://github.com/liquid4all/cookbook/blob/main/finetuning/notebooks/grpo_with_unsloth.ipynb Installs necessary libraries like unsloth and vllm, and sets an environment variable for Unsloth's VLLM standby mode. ```python %%capture import os os.environ["UNSLOTH_VLLM_STANDBY"] = "1" # [NEW] Extra 30% context lengths! if "COLAB_" not in "".join(os.environ.keys()): # If you're not in Colab, just use pip install or uv pip install !pip install unsloth vllm else: pass # For Colab / Kaggle, we need extra instructions hidden below \/ ``` -------------------------------- ### Setup Development Environment Source: https://github.com/liquid4all/cookbook/blob/main/examples/localcowork/docs/contributing.md Clones the repository and runs the setup script to install dependencies and configure the development environment. ```bash git clone && cd localCoWork ./scripts/setup-dev.sh ``` -------------------------------- ### One-time setup Source: https://github.com/liquid4all/cookbook/blob/main/examples/home-assistant/README.md Clones the leap-finetune repository, installs dependencies, and authenticates with HuggingFace and Modal. ```bash git clone https://github.com/Liquid4All/leap-finetune cd leap-finetune && uv sync && cd - huggingface-cli login modal setup ``` -------------------------------- ### Quick start: Clone repository and run locally Source: https://github.com/liquid4all/cookbook/blob/main/examples/meeting-summarization/README.md This command clones the repository, navigates to the example directory, and runs the summarization CLI with specific model and transcript file arguments. ```sh git clone https://github.com/Liquid4All/cookbook.git cd cookbook/examples/meeting-summarization uv run summarize.py \ --model LiquidAI/LFM2-2.6B-Transcript-GGUF \ --hf-model-file LFM2-2.6B-Transcript-1-GGUF.gguf \ --transcript-file transcripts/example_1.txt ``` -------------------------------- ### Environment Variable Setup Source: https://github.com/liquid4all/cookbook/blob/main/examples/voice-assistant/README.md Instructions to copy the example environment file and add the HF_TOKEN. ```bash cp .env.example .env # then edit .env and replace hf_xxx with your token ``` -------------------------------- ### Quick Start: Run Published Fine-tuned Model Source: https://github.com/liquid4all/cookbook/blob/main/examples/voice-assistant/README.md Commands to clone the repository, install dependencies, and run the evaluation script for the published fine-tuned model. ```bash git clone https://github.com/Liquid4All/cookbook cd cookbook/examples/voice-assistant uv sync uv run python scripts/eval.py --config configs/finetuned-q8.yaml ``` -------------------------------- ### Run Locally Source: https://github.com/liquid4all/cookbook/blob/main/examples/hand-voice-racer/README.md Commands to install dependencies and start the development server for the Hand & Voice Racer project. ```bash npm install npm run dev ``` -------------------------------- ### Install dependencies Source: https://github.com/liquid4all/cookbook/blob/main/examples/audio-webgpu-demo/README.md Installs project dependencies specified in package.json using npm. ```sh npm install ``` -------------------------------- ### One-time setup for fine-tuning Source: https://github.com/liquid4all/cookbook/blob/main/examples/home-assistant/CLAUDE.md Clones the fine-tuning repository, installs dependencies, logs into Hugging Face, and sets up Modal. ```bash git clone https://github.com/Liquid4All/leap-finetune cd leap-finetune && uv sync && cd - huggingface-cli login modal setup ``` -------------------------------- ### Install Dependencies Source: https://github.com/liquid4all/cookbook/blob/main/finetuning/notebooks/cpt_text_completion_with_unsloth.ipynb Installs necessary libraries for fine-tuning, with conditional installation for Google Colab. ```python %%capture import os, re if "COLAB_" not in "".join(os.environ.keys()): !pip install unsloth else: # Do this only in Colab notebooks! Otherwise use pip install unsloth import torch; v = re.match(r"[0-9]{1,}\.[0-9]{1,}", str(torch.__version__)).group(0) xformers = "xformers==" + ("0.0.33.post1" if v=="2.9" else "0.0.32.post2" if v=="2.8" else "0.0.29.post3") !pip install --no-deps bitsandbytes accelerate {xformers} peft trl triton cut_cross_entropy unsloth_zoo !pip install sentencepiece protobuf "datasets==4.3.0" "huggingface_hub>=0.34.0" hf_transfer !pip install --no-deps unsloth !pip install transformers==4.57.3 !pip install --no-deps trl==0.22.2 ``` -------------------------------- ### Install uv Source: https://github.com/liquid4all/cookbook/blob/main/examples/audio-transcription-cli/README.md Installs the uv package manager on macOS/Linux or Windows. ```sh curl -LsSf https://astral.sh/uv/install.sh | sh ``` ```powershell powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Print First Dataset Example Source: https://github.com/liquid4all/cookbook/blob/main/finetuning/notebooks/cpt_translation_with_unsloth.ipynb Prints the first example from the loaded Alpaca dataset to show its structure. ```python print(alpaca_dataset[0]) ``` -------------------------------- ### Quick start commands Source: https://github.com/liquid4all/cookbook/blob/main/examples/audio-car-cockpit/README.md Commands to set up the Python environment, prepare the audio and tool calling models, and launch the demo. ```bash # Setup python env make setup # Optional: if llama-server is already in your PATH, symlink it instead of building # ln -s $(which llama-server) llama-server # Note: when building for ROCm, also install: sudo apt install -y libstdc++-14-dev # Prepare the audio and tool calling models make LFM2.5-Audio-1.5B-GGUF LFM2-1.2B-Tool-GGUF # Launch demo make -j2 audioserver serve ``` -------------------------------- ### System Prompt Example Source: https://github.com/liquid4all/cookbook/blob/main/examples/localcowork/docs/patterns/context-window-management.md The system prompt is loaded once at conversation start and never evicted. ```text You are LocalCowork, a private desktop assistant. You help users manage files, documents, emails, calendars, and tasks — entirely on their local machine. Rules: 1. Never write code. Use only the tools provided. 2. For mutable actions, show preview and wait for confirmation. 3. For destructive actions, show explicit warning. 4. Explain what you'll do before calling tools. 5. For multi-step tasks, plan first, then execute step by step. ``` -------------------------------- ### Setup Before Webinar Source: https://github.com/liquid4all/cookbook/blob/main/examples/local-coding-assistant/MEETING_INTELLIGENCE.md Commands to set up the environment for the live demo, including syncing dependencies and copying the .env file. ```bash cd examples/meeting-intelligence-agent uv sync cp .env.example .env # Add ANTHROPIC_API_KEY to .env (for the Anthropic backend demo) ``` -------------------------------- ### Start the development server Source: https://github.com/liquid4all/cookbook/blob/main/examples/audio-webgpu-demo/README.md Starts the development server, typically providing a local URL like http://localhost:5173 to access the app in the browser. ```sh npm run dev ``` -------------------------------- ### Install and authenticate Modal Source: https://github.com/liquid4all/cookbook/blob/main/examples/satellite-vlm/README.md Installs dependencies and logs into Modal and Hugging Face. This is the first step in setting up the environment for fine-tuning. ```bash uv sync uv run python -m modal setup uv run huggingface-cli login ``` -------------------------------- ### Install XcodeGen Source: https://github.com/liquid4all/cookbook/blob/main/examples/telco-triage-ios/README.md Installs XcodeGen using Homebrew if it's not already installed. ```bash brew install xcodegen ``` -------------------------------- ### Starting a Model Server Source: https://github.com/liquid4all/cookbook/blob/main/examples/localcowork/docs/model-analysis/README.md Commands to start a local model server using llama-server or Ollama, which are prerequisites for running benchmarks. ```bash # LFM2-24B via llama-server (default port 8080) llama-server -m _models/LFM2-24B-A2B-Q4_K_M.gguf --port 8080 # Any Ollama model (default port 11434) ollama run llama3.2 ``` -------------------------------- ### Install Dependencies Source: https://github.com/liquid4all/cookbook/blob/main/finetuning/notebooks/cpt_translation_with_unsloth.ipynb Installs necessary libraries including Unsloth, transformers, and other dependencies. It includes conditional installation for Google Colab environments. ```python %%capture import os, re if "COLAB_" not in "".join(os.environ.keys()): !pip install unsloth else: # Do this only in Colab notebooks! Otherwise use pip install unsloth import torch; v = re.match(r"[0-9]{1,}\\.[0-9]{1,}", str(torch.__version__)).group(0) xformers = "xformers==" + ("0.0.33.post1" if v=="2.9" else "0.0.32.post2" if v=="2.8" else "0.0.29.post3") !pip install --no-deps bitsandbytes accelerate {xformers} peft trl triton cut_cross_entropy unsloth_zoo !pip install sentencepiece protobuf "datasets==4.3.0" "huggingface_hub>=0.34.0" hf_transfer !pip install --no-deps unsloth !pip install transformers==4.57.3 !pip install --no-deps trl==0.22.2 ``` -------------------------------- ### Colab/Kaggle Specific Installation Source: https://github.com/liquid4all/cookbook/blob/main/finetuning/notebooks/grpo_with_unsloth.ipynb Handles installation for Colab/Kaggle environments, including conditional installation of libraries based on GPU type and specific versions of dependencies. ```python #@title Colab Extra Install { display-mode: "form" } %%capture import os !pip install --upgrade -qqq uv if "COLAB_" not in "".join(os.environ.keys()): # If you're not in Colab, just use pip install! !pip install unsloth vllm else: try: import numpy, PIL; get_numpy = f"numpy=={numpy.__version__}"; get_pil = f"pillow=={PIL.__version__}" except: get_numpy = "numpy"; get_pil = "pillow" try: import subprocess; is_t4 = "Tesla T4" in str(subprocess.check_output(["nvidia-smi"])) except: is_t4 = False get_vllm, get_triton = ("vllm==0.9.2", "triton==3.2.0") if is_t4 else ("vllm==0.11.2", "triton") !uv pip install -qqq --upgrade \ unsloth {get_vllm} {get_numpy} {get_pil} torchvision bitsandbytes xformers !uv pip install -qqq {get_triton} !uv pip install transformers==4.57.1 !uv pip install --no-deps trl==0.22.2 ``` -------------------------------- ### Build the Docker image Source: https://github.com/liquid4all/cookbook/blob/main/examples/vl-webgpu-demo/README.md Builds the Docker image for the application. ```sh # Build the Docker image docker build -t lfm-vl-webgpu -f LFM2.5-VL-1.6B-WebGPU/Dockerfile . ``` -------------------------------- ### Install Dependencies Source: https://github.com/liquid4all/cookbook/blob/main/finetuning/notebooks/sft_for_vision_language_model.ipynb Installs necessary libraries including Unsloth, transformers, and other dependencies. It includes conditional installation for Google Colab environments. ```python %%capture import os, re if "COLAB_" not in "".join(os.environ.keys()): !pip install unsloth else: # Do this only in Colab notebooks! Otherwise use pip install unsloth import torch; v = re.match(r"[0-9]{1,}\.[0-9]{1,}", str(torch.__version__)).group(0) xformers = "xformers==" + ("0.0.33.post1" if v=="2.9" else "0.0.32.post2" if v=="2.8" else "0.0.29.post3") !pip install --no-deps bitsandbytes accelerate {xformers} peft trl triton cut_cross_entropy unsloth_zoo !pip install sentencepiece protobuf "datasets==4.3.0" "huggingface_hub>=0.34.0" hf_transfer !pip install --no-deps unsloth !pip install git+https://github.com/huggingface/transformers.git@3c2517727ce28a30f5044e01663ee204deb1cdbe !pip install --no-deps trl==0.22.2 ``` -------------------------------- ### Deploy the server Source: https://github.com/liquid4all/cookbook/blob/main/examples/voice-chat/README.md Deploys the server component of the voice chat application to Modal. ```bash make deploy-server ``` ```bash uv run modal deploy -m src.voice_chat.server ``` -------------------------------- ### Run the container Source: https://github.com/liquid4all/cookbook/blob/main/examples/vl-webgpu-demo/README.md Runs the Docker container and exposes the application. ```sh # Run the container docker run -p 7860:7860 lfm-vl-webgpu ``` -------------------------------- ### Install flash-attn Source: https://github.com/liquid4all/cookbook/blob/main/finetuning/notebooks/grpo_for_verifiable_tasks.ipynb Installs the flash-attn library, which is often used for optimized attention mechanisms in deep learning models. The output indicates successful installation. ```bash #!pip install trackio Created wheel for flash-attn: filename=flash_attn-2.8.3-cp312-cp312-linux_x86_64.whl size=253780426 sha256=4e2f9e39313266b1544b68138b15b91ee6221eccf14f7902b7c6620351340810 Stored in directory: /root/.cache/pip/wheels/3d/59/46/f282c12c73dd4bb3c2e3fe199f1a0d0f8cec06df0cccfeee27 Successfully built flash-attn Installing collected packages: flash-attn Successfully installed flash-attn-2.8.3 ``` -------------------------------- ### Start the app server Source: https://github.com/liquid4all/cookbook/blob/main/examples/home-assistant/README.md Command to start the local Home Assistant application server using uv and uvicorn. ```bash uv run uvicorn app.server:app --port 5173 --reload ``` -------------------------------- ### LFM format example Source: https://github.com/liquid4all/cookbook/blob/main/finetuning/notebooks/sft_with_unsloth.ipynb Example of the LFM format for multi-turn conversations. ```text <|startoftext|><|im_start|>user Hello!<|im_end|> <|im_start|>assistant Hey there!<|im_end|> ``` -------------------------------- ### Kick off training on Modal Source: https://github.com/liquid4all/cookbook/blob/main/examples/home-assistant/README.md Starts LoRA SFT training on Modal for 5 epochs using a specified configuration file. ```bash cd leap-finetune uv run leap-finetune ../finetune/configs/LFM2-350M.yaml ``` -------------------------------- ### Install llama.cpp on Linux Source: https://github.com/liquid4all/cookbook/blob/main/examples/invoice-parser/README.md Installs llama.cpp by building from source on Linux. ```bash git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build --config Release # Add build/bin to your PATH ``` -------------------------------- ### Start the llama.cpp server Source: https://github.com/liquid4all/cookbook/blob/main/examples/local-coding-assistant/tasks/create_mvp/plan.md Command to start the llama.cpp server, specifying the model file, context size, and port. ```bash # Start the llama.cpp server with LFM2-24B-A2B Q4_0 ./llama-server \ --model /path/to/LFM2-24B-A2B-Q4_0.gguf \ --ctx-size 8192 \ --port 8080 ``` -------------------------------- ### Install llama.cpp on macOS Source: https://github.com/liquid4all/cookbook/blob/main/examples/invoice-parser/README.md Installs llama.cpp using Homebrew on macOS. ```bash brew install llama.cpp ``` -------------------------------- ### Install uv Source: https://github.com/liquid4all/cookbook/blob/main/examples/flight-search-assistant/README.md Command to check if uv is installed. ```bash uv --version ``` -------------------------------- ### main.py - CLI Entry Point Source: https://github.com/liquid4all/cookbook/blob/main/examples/local-coding-assistant/tasks/create_mvp/plan.md Provides a simple REPL for interacting with the agent, handling input, history, and graceful exits. ```bash # Use Anthropic (validation) export LCA_BACKEND=anthropic export ANTHROPIC_API_KEY=sk-ant-... lca ``` -------------------------------- ### Run the client Source: https://github.com/liquid4all/cookbook/blob/main/examples/voice-chat/README.md Runs the client component of the voice chat application, which interacts with the deployed server. ```bash make run ``` ```bash uv run modal run -m src.voice_chat.client ```