nlp-project-setup
Set up Python environment for NLP and preference optimization projects.
- License 许可
- MIT
- 最近更新
- 2026-10-02
- Stars
- ★ 93
- Forks
- 7
01 前言 Front Matter
- name
- nlp-project-setup
- description
- Set up Python environment for NLP and preference optimization projects.
03 SKILL.md 正文
NLP Project Environment Setup
Environment Requirements for SimPO
Core Dependencies
- PyTorch: Deep learning framework (torch, torchvision, torchaudio)
- Transformers: Hugging Face library for LLMs
- NumPy: Numerical computing
- SciPy: Scientific computing utilities
- tqdm: Progress bars for training loops
Optional but Recommended
- wandb: Experiment tracking
- accelerate: Distributed training
- bitsandbytes: 8-bit optimization
- Flash-Attn: Efficient attention
Installation Steps
1. Check Python Version
python --version # Should be 3.8+
python -VV # Detailed version info
2. Create Virtual Environment (Optional)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
3. Install Core Dependencies
# PyTorch (CUDA 12.1 example)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
# Transformers
pip install transformers
# Other essentials
pip install numpy scipy tqdm
4. Verify Installation
python -c "import torch; print(torch.__version__)"
python -c "import transformers; print(transformers.__version__)"
Dependency Version Considerations
For SimPO Specifically
- transformers >= 4.30.0 (for AutoTokenizer, model loading)
- torch >= 1.13.0 (for modern PyTorch features)
- numpy (for .npz file saving)
Compatibility Notes
- Different CUDA versions may require different torch builds
- GPU memory requirements: typically 10-20GB for 7B models
- CPU-only mode works but is much slower
Requirements File
Create requirements.txt:
torch>=1.13.0
transformers>=4.30.0
numpy
scipy
tqdm
accelerate>=0.20.0
Then install:
pip install -r requirements.txt
Logging Installed Packages
# Save package list
python -m pip freeze > /root/python_info.txt
# Or capture with version info
python -VV >> /root/python_info.txt
python -m pip freeze >> /root/python_info.txt
Troubleshooting
CUDA/GPU Issues
# Check if CUDA available
python -c "import torch; print(torch.cuda.is_available())"
# Find CUDA version
nvidia-smi # Shows CUDA version
# Match PyTorch to CUDA version
# Visit: https://pytorch.org/get-started/locally/
Missing Dependencies
# Install specific package
pip install <package_name>
# Or reinstall all from requirements
pip install --force-reinstall -r requirements.txt
Version Conflicts
# Show package version
pip show <package_name>
# Check compatibility
pip check
04 同仓库更多 Skills
object_counter
Count occurrences of an object in the image using computer vision algorithm.
travel-planning-workflow
Invoke this skill when performing travel planning. It defines a structured workflow for generating itineraries. Following this workflow is essential to ensure the final plan satisfies user requirements.
bundled-dataset-search-tool
invoke this skill when you need to perform database search for travel planning. This skill provides some useful pre-packaged tools to look up accommodations, attractions, cities, driving distance, flights, and restaurants from the bundled dataset.
glm-output
Output-processing guidance for GLM tasks. Especially useful after glm-basics and glm-calibration when you need verifier-matching metrics from output.nc and a final /root/metrics.json.
glm-calibration
Calibration guidance for GLM tasks. Often most effective after glm-basics has clarified the setup; glm-output is the companion skill for exact final metric computation.
glm-basics
A good starting point for GLM calibration tasks. Use to inspect glm3.nml, confirm how GLM runs, and identify the relevant files before moving on to calibration and output evaluation.