### Start MonetGPT LLM Server Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Command to start the LLM server for MonetGPT inference. ```bash cd llm sh test.sh cd .. ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Steps to clone the MonetGPT repository, set up a conda environment, and install project dependencies. ```bash git clone https://github.com/monetgpt/monetgpt.git cd monetgpt conda create -n monetgpt python=3.11 conda activate monetgpt cd llm sh install.sh ``` -------------------------------- ### Start LLaMA Board GUI Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Launch the web-based GUI for fine-tuning using Gradio. This command starts the interactive interface for managing training processes. ```bash llamafactory-cli webui ``` -------------------------------- ### Install and Login to Hugging Face CLI Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Install the huggingface_hub library and log in to your Hugging Face account. This is required for accessing certain datasets. ```bash pip install --upgrade huggingface_hub huggingface-cli login ``` -------------------------------- ### Install LLaMA-Factory with Core Dependencies Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Clone the repository and install the base package with PyTorch and metrics dependencies. Use '--no-deps' to avoid potential package conflicts. ```bash git clone --depth 1 https://github.com/hiyouga/LLaMA-Factory.git cd LLaMA-Factory pip install -e " .[torch,metrics]" ``` ```bash pip install --no-deps -e . ``` -------------------------------- ### Dataset Configuration Example Source: https://github.com/niladridutt/monetgpt/blob/main/README.md YAML configuration for dataset settings, including LLM parameters and puzzle paths. Ensure API keys and paths are correctly set. ```yaml # LLM settings for reasoning generation model: "gemini-2.0-flash" api_key: "" # Set your API key here base_url: "https://generativelanguage.googleapis.com/v1beta/openai/" timeout: 5 retry_attempts: 1 # Puzzle paths and settings puzzles: puzzle1: reasoning_path: "./data/puzzles1/reasoning/*.txt" images_path: "./data/puzzles1/images/*.png" images_base_path: "./data/puzzles1/images" output_file: "data/sharegpt_puzzle_1.json" puzzle2: reasoning_path: "./data/puzzles2/reasoning/*.txt" images_path: "./data/puzzles2/images/*.png" images_base_path: "./data/puzzles2/images" output_file: "data/sharegpt_puzzle_2.json" puzzle3: reasoning_path: "./data/puzzles3/reasoning/*.txt" images_path: "./data/puzzles3/images/*/*.tif" images_base_path: "./data/puzzles3/images" output_file: "data/sharegpt_puzzle_3.json" # Generation settings generation: num_standard_trials: 2 num_color_trials: 1 num_puzzle3_trials: 10 ``` -------------------------------- ### Install bitsandbytes for Windows (QLoRA) Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md For Windows users enabling quantized LoRA (QLoRA), install a pre-built bitsandbytes wheel compatible with your CUDA version. ```bash pip install https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.41.2.post2-py3-none-win_amd64.whl ``` -------------------------------- ### Install FlashAttention-2 for Windows Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md To enable FlashAttention-2 on Windows, install a precompiled version compatible with your CUDA version from the provided releases. ```bash # Please download the corresponding version from [flash-attention](https://github.com/bdashore3/flash-attention/releases) based on your requirements. ``` -------------------------------- ### Install NumPy for GIMP (Linux Flatpak) Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Command to install the NumPy library for GIMP when using the Linux Flatpak version. ```bash flatpak run --command=sh org.gimp.GIMP//stable -c "python -m pip install --user numpy" ``` -------------------------------- ### Run Batch Image Processing with MonetGPT Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Example command to process multiple images in a directory using the MonetGPT batch processing mode. ```bash python inference_cli.py batch assets/test --output-dir results/ ``` -------------------------------- ### Install GIMP 2.10 on Linux via Flatpak Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Instructions for installing GIMP version 2.10 using Flatpak on Linux systems, including adding the Flathub repository. ```bash sudo apt update sudo apt install flatpak flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak install flathub org.gimp.GIMP//2.10 ``` -------------------------------- ### Deploy with OpenAI-style API and vLLM Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Start an API server using vLLM for efficient inference, compatible with OpenAI's API format. Specify the API port and the model configuration YAML. ```bash API_PORT=8000 llamafactory-cli api examples/inference/llama3_vllm.yaml ``` -------------------------------- ### Install LLaMA-Factory on Ascend NPU Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Install LLaMA Factory with Ascend NPU specific dependencies and the Ascend CANN Toolkit and Kernels. Set environment variables to use NPU devices. ```bash pip install -e ".[torch-npu,metrics]" ``` ```bash # replace the url according to your CANN version and devices # install CANN Toolkit wget https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL%20V100R001C17SPC701/Ascend-cann-toolkit_8.0.RC1.alpha001_linux-$(uname -i).run bash Ascend-cann-toolkit_8.0.RC1.alpha001_linux-$(uname -i).run --install # install CANN Kernels wget https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL%20V100R001C17SPC701/Ascend-cann-kernels-910b_8.0.RC1.alpha001_linux.run bash Ascend-cann-kernels-910b_8.0.RC1.alpha001_linux.run --install # set env variables source /usr/local/Ascend/ascend-toolkit/set_env.sh ``` ```bash # Remember to use `ASCEND_RT_VISIBLE_DEVICES` instead of `CUDA_VISIBLE_DEVICES` to specify the device to use. ``` -------------------------------- ### Pipeline Configuration Example Source: https://github.com/niladridutt/monetgpt/blob/main/README.md YAML configuration for GIMP and image processing settings. Specifies paths for GIMP executables and processing parameters like batch size and timeout. ```yaml # GIMP settings gimp: paths: macos: "/Applications/GIMP.app/Contents/MacOS/gimp-console-2.10" linux: "flatpak run org.gimp.GIMP//stable --no-interface" windows: "gimp-console-2.10.exe" (Not tested, may require some modifications) batch_interpreter: "python-fu-eval" python_warnings: "ignore" pipeline_file: "./gimp_pipeline.py" # Image processing settings image_processing: max_low_res_size: 700 # Low resolution for MLLM training only default_dpi: 140 # Original resolution is preserved during inference # Processing parameters processing: batch_size: 10 max_workers: 4 timeout_seconds: 120 ``` -------------------------------- ### Run Single Image Processing with MonetGPT Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Example command to perform image enhancement or retouching on a single input image using the MonetGPT CLI. ```bash python inference_cli.py single input.jpg --output results/edited.jpg ``` -------------------------------- ### Install Git LFS Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Ensure Git Large File Storage (LFS) is installed to handle large model files. Run this command in your terminal. ```bash git lfs install ``` -------------------------------- ### Build Docker Image with Docker Compose (CUDA) Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Build and run the Docker image for CUDA users using Docker Compose. This simplifies the setup for GPU-accelerated environments. ```bash cd docker/docker-cuda/ docker compose up -d docker compose exec llamafactory bash ``` -------------------------------- ### Prepare Training Data Directory Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Creates the necessary directory structure for training images. ```bash mkdir -p data/ppr10k ``` -------------------------------- ### Download Pre-trained MonetGPT Model Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Instructions for downloading the pre-trained MonetGPT model using the Hugging Face CLI or by cloning the repository. ```bash cd llm mkdir -p models cd models huggingface-cli download niladridutt/monetGPT # OR Clone the model repository (requires git lfs) git clone https://huggingface.co/niladridutt/monetGPT ``` -------------------------------- ### Create Final ShareGPT Format Datasets Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Creates datasets in ShareGPT format for all generated puzzles. Ensure the output file is placed correctly for training. ```bash python dataset_cli.py create # Create datasets for all puzzles ``` -------------------------------- ### Build Docker Image with Docker Compose (Ascend NPU) Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Build and run the Docker image for Ascend NPU users using Docker Compose. Ensure your environment is compatible with Ascend hardware. ```bash cd docker/docker-npu/ docker compose up -d docker compose exec llamafactory bash ``` -------------------------------- ### Combine Datasets for Training Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Combines JSON datasets and exports them for training. The combined file should be named 'monetgpt.json' and placed under the 'llm/data' directory. ```bash python dataset/combine_jsons.py # Combine JSON datasets and export for training ``` -------------------------------- ### Run LoRA Fine-tuning, Inference, and Merging Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Execute commands for LoRA fine-tuning, inference, and merging of the Llama3-8B-Instruct model. Ensure the necessary YAML configuration files are in place. ```bash llamafactory-cli train examples/train_lora/llama3_lora_sft.yaml ``` ```bash llamafactory-cli chat examples/inference/llama3_lora_sft.yaml ``` ```bash llamafactory-cli export examples/merge_lora/llama3_lora_sft.yaml ``` -------------------------------- ### Train MonetGPT Model Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Trains the MonetGPT model on the generated datasets. This command should be run from the 'llm' directory. ```bash cd llm sh train.sh ``` -------------------------------- ### Configure Weights & Biases Logging Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Add these arguments to your YAML file to enable logging with Weights & Biases. Ensure WANDB_API_KEY is set. ```yaml report_to: wandb run_name: test_run # optional ``` -------------------------------- ### Enable ModelScope Hub Usage Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Set an environment variable to use ModelScope Hub for downloading models and datasets. This is an alternative to Hugging Face Hub. ```bash export USE_MODELSCOPE_HUB=1 # `set USE_MODELSCOPE_HUB=1` for Windows ``` -------------------------------- ### Build Docker Image without Docker Compose (Ascend NPU) Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Manually build the Docker image for Ascend NPU users. This method allows for specific configurations and device mapping for NPU hardware. ```bash # Choose docker image upon your environment docker build -f ./docker/docker-npu/Dockerfile \ --build-arg INSTALL_DEEPSPEED=false \ --build-arg PIP_INDEX=https://pypi.org/simple \ -t llamafactory:latest . # Change `device` upon your resources docker run -dit \ -v ./hf_cache:/root/.cache/huggingface \ -v ./ms_cache:/root/.cache/modelscope \ -v ./om_cache:/root/.cache/openmind \ -v ./data:/app/data \ -v ./output:/app/output \ -v /usr/local/dcmi:/usr/local/dcmi \ -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \ -v /usr/local/Ascend/driver:/usr/local/Ascend/driver \ -v /etc/ascend_install.info:/etc/ascend_install.info \ -p 7860:7860 \ -p 8000:8000 \ --device /dev/davinci0 \ --device /dev/davinci_manager \ --device /dev/devmm_svm \ --device /dev/hisi_hdc \ --shm-size 16G \ --name llamafactory \ llamafactory:latest docker exec -it llamafactory bash ``` -------------------------------- ### Generate Multi-Version Comparison Puzzles Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Generates multi-version comparison puzzles using the pipeline CLI. This helps in teaching parameter value relationships. ```bash python pipeline_cli.py puzzle 2 ``` -------------------------------- ### Build Docker Image with Docker Compose (AMD ROCm) Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Build and run the Docker image for AMD ROCm users using Docker Compose. This is for environments utilizing AMD GPUs with ROCm support. ```bash cd docker/docker-rocm/ docker compose up -d docker compose exec llamafactory bash ``` -------------------------------- ### Create Visual Puzzle Images Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Creates visual puzzle images using the pipeline CLI. Supports generating single operation, multi-version comparison, comprehensive editing, or all puzzle types. ```bash python pipeline_cli.py puzzle 1 # Single operation puzzles ``` ```bash python pipeline_cli.py puzzle 2 # Multi-version comparison puzzles ``` ```bash python pipeline_cli.py puzzle 3 # Comprehensive editing puzzles ``` ```bash python pipeline_cli.py puzzle all # Generate all puzzle types ``` -------------------------------- ### Generate Comprehensive Editing Puzzles Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Generates comprehensive editing puzzles using the pipeline CLI. These puzzles teach complete retouching workflows. ```bash python pipeline_cli.py puzzle 3 ``` -------------------------------- ### Batch Process Images with MonetGPT Predictions Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Processes multiple images in batch using MonetGPT predictions. Specify the target editor for the batch processing. ```bash python pipeline_cli.py batch predictions --target-editor a ``` -------------------------------- ### Apply Single Image Edit Configuration Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Applies a specific retouching configuration to a single input image and saves the output. ```bash python pipeline_cli.py edit configs/example_edit.json input.jpg output.jpg ``` -------------------------------- ### Generate Puzzle Configurations Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Generates puzzle configurations using the dataset CLI. Use different arguments for single operation, multi-version, or comprehensive editing puzzles. ```bash python dataset_cli.py generate ``` -------------------------------- ### Configure SwanLab Logging Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Add these arguments to your YAML file to enable logging with SwanLab. You can log in via API key in YAML, environment variable, or the `swanlab login` command. ```yaml use_swanlab: true swanlab_run_name: test_run # optional ``` -------------------------------- ### Build Docker Image without Docker Compose (AMD ROCm) Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Manually build the Docker image for AMD ROCm users. This command configures the build for AMD GPUs and maps necessary devices. ```bash docker build -f ./docker/docker-rocm/Dockerfile \ --build-arg INSTALL_BNB=false \ --build-arg INSTALL_VLLM=false \ --build-arg INSTALL_DEEPSPEED=false \ --build-arg INSTALL_FLASHATTN=false \ --build-arg PIP_INDEX=https://pypi.org/simple \ -t llamafactory:latest . docker run -dit \ -v ./hf_cache:/root/.cache/huggingface \ -v ./ms_cache:/root/.cache/modelscope \ -v ./om_cache:/root/.cache/openmind \ -v ./data:/app/data \ -v ./output:/app/output \ -v ./saves:/app/saves \ -p 7860:7860 \ -p 8000:8000 \ --device /dev/kfd \ --device /dev/dri \ --shm-size 16G \ --name llamafactory \ llamafactory:latest docker exec -it llamafactory bash ``` -------------------------------- ### Generate All Puzzle Types Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Generates all available puzzle types using the pipeline CLI. This is a convenient option for creating a complete set of training data. ```bash python pipeline_cli.py puzzle all ``` -------------------------------- ### Build Docker Image without Docker Compose (CUDA) Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Manually build the Docker image for CUDA users without Docker Compose. This provides more control over the build process and arguments. ```bash docker build -f ./docker/docker-cuda/Dockerfile \ --build-arg INSTALL_BNB=false \ --build-arg INSTALL_VLLM=false \ --build-arg INSTALL_DEEPSPEED=false \ --build-arg INSTALL_FLASHATTN=false \ --build-arg PIP_INDEX=https://pypi.org/simple \ -t llamafactory:latest . docker run -dit --gpus=all \ -v ./hf_cache:/root/.cache/huggingface \ -v ./ms_cache:/root/.cache/modelscope \ -v ./om_cache:/root/.cache/openmind \ -v ./data:/app/data \ -v ./output:/app/output \ -p 7860:7860 \ -p 8000:8000 \ --shm-size 16G \ --name llamafactory \ llamafactory:latest docker exec -it llamafactory bash ``` -------------------------------- ### Generate Single Operation Puzzles Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Generates single operation puzzles using the pipeline CLI. This is useful for teaching individual retouching operations. ```bash python pipeline_cli.py puzzle 1 ``` -------------------------------- ### BibTeX Citation for LlamaFactory Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md This is the BibTeX entry to cite the LlamaFactory work, which is relevant to the MonetGPT project. ```bibtex @inproceedings{zheng2024llamafactory, title={LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models}, author={Yaowei Zheng and Richong Zhang and Junhao Zhang and Yanhan Ye and Zheyan Luo and Zhangchi Feng and Yongqiang Ma}, booktitle={Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 3: System Demonstrations)}, address={Bangkok, Thailand}, publisher={Association for Computational Linguistics}, year={2024}, url={http://arxiv.org/abs/2403.13372} } ``` -------------------------------- ### Set Modelers Hub Environment Variable Source: https://github.com/niladridutt/monetgpt/blob/main/llm/README.md Set the USE_OPENMIND_HUB environment variable to 1 to enable downloading models from Modelers Hub. Use `set` for Windows. ```bash export USE_OPENMIND_HUB=1 # `set USE_OPENMIND_HUB=1` for Windows ``` -------------------------------- ### Generate LLM Reasoning for Puzzles Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Queries the LLM to add reasoning to puzzle configurations. Specify puzzle type and range for reasoning generation. ```bash python dataset_cli.py query 1 0 -1 # Generate reasoning for all puzzle 1 configs (all) ``` ```bash python dataset_cli.py query 2 0 -1 # Generate reasoning for puzzle 2 configs (all) ``` ```bash python dataset_cli.py query 3 0 -1 # Generate reasoning for puzzle 3 configs (all) ``` -------------------------------- ### MonetGPT Citation (BibTeX) Source: https://github.com/niladridutt/monetgpt/blob/main/README.md Use this BibTeX entry to cite MonetGPT in academic publications. It includes details about the paper, authors, journal, and publication year. ```bibtex @article{dutt2025monetgpt, title={MonetGPT: Solving Puzzles Enhances MLLMs' Image Retouching Skills}, author={Dutt, Niladri Shekhar and Ceylan, Duygu and Mitra, Niloy J}, journal={ACM Transactions on Graphics (TOG)}, volume={44}, number={4}, pages={1--12}, year={2025}, publisher={ACM New York, NY, USA} } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.