Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Microsoft LoRA NLG Environment Setup Script

From Leeroopedia
Revision as of 15:43, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Microsoft_LoRA_NLG_Environment_Setup_Script.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Overview

NLG_Environment_Setup_Script provides the concrete commands for installing Python dependencies and downloading pretrained GPT-2 checkpoints required by the LoRA NLG fine-tuning pipeline. This implementation covers two shell-level entry points: pip install -r requirement.txt and bash download_pretrained_checkpoints.sh.

Type

External Tool Doc

Source

  • examples/NLG/requirement.txt (lines 1-7)
  • examples/NLG/download_pretrained_checkpoints.sh (lines 1-11)

Signature

Dependency Installation

pip install -r requirement.txt

The requirement.txt file contains the following pinned dependencies:

--find-links https://download.pytorch.org/whl/torch_stable.html
torch==1.7.1+cu101
transformers==3.3.1
spacy
tqdm
tensorboard
progress

Checkpoint Download

bash download_pretrained_checkpoints.sh

The script performs the following operations:

#!/bin/bash
echo "downloading pretrained model checkpoints..."
mkdir pretrained_checkpoints
cd pretrained_checkpoints
wget https://s3.amazonaws.com/models.huggingface.co/bert/gpt2-pytorch_model.bin
wget https://s3.amazonaws.com/models.huggingface.co/bert/gpt2-medium-pytorch_model.bin
wget https://s3.amazonaws.com/models.huggingface.co/bert/gpt2-large-pytorch_model.bin
cd ..
echo "script complete!"

Input / Output

Direction Description
Input A clean Python environment (virtualenv or conda) with pip and wget available.
Output
  • Installed Python packages: torch, transformers, spacy, tqdm, tensorboard, progress.
  • Pretrained checkpoint files in pretrained_checkpoints/:
    • gpt2-pytorch_model.bin (GPT-2 Small, ~500MB)
    • gpt2-medium-pytorch_model.bin (GPT-2 Medium, ~1.5GB)
    • gpt2-large-pytorch_model.bin (GPT-2 Large, ~3GB)

Notes

  • The --find-links directive in requirement.txt points pip to the PyTorch wheel index for CUDA 10.1 builds. If using a different CUDA version, modify this line accordingly.
  • The loralib package is not listed in requirement.txt and must be installed separately, typically via pip install loralib or from the repository root.
  • The regex package is also required by the BPE encoder (encoder.py) but is not listed in the requirements file. Install it via pip install regex.

Metadata

Field Value
Source microsoft/LoRA
Type External Tool Doc
Last Updated 2026-02-10

Related

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment