Troubleshooting
Common issues and solutions when using OpenTryOn.
Import Errors
Issue: ModuleNotFoundError
Error:
ModuleNotFoundError: No module named 'tryon'
Solution: Ensure OpenTryOn is installed:
pip install -e .
Or install dependencies:
pip install -r requirements.txt
CUDA Issues
Issue: CUDA Out of Memory
Error:
RuntimeError: CUDA out of memory
Solutions:
- Reduce batch size
- Reduce image resolution
- Use CPU instead of GPU:
import os
os.environ["CUDA_VISIBLE_DEVICES"] = ""
Issue: CUDA Not Available
Error:
CUDA not available, using CPU
Solutions:
- Check CUDA installation:
import torch
print(torch.cuda.is_available())
- Install CUDA-compatible PyTorch:
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
Model Checkpoint Issues
Issue: Checkpoint Not Found
Error:
FileNotFoundError: Checkpoint not found
Solution:
- Verify checkpoint path in
.envfile - Ensure checkpoint file exists at specified path
- Download missing checkpoints:
# U2Net cloth segmentation
wget https://huggingface.co/levihsu/OOTDiffusion/resolve/main/cloth_segm.pth
Environment Variable Issues
Issue: Environment Variables Not Loaded
Error:
KeyError: 'U2NET_CLOTH_SEG_CHECKPOINT_PATH'
Solution: Always load environment variables first:
from dotenv import load_dotenv
load_dotenv()
# Then import OpenTryOn modules
from tryon.preprocessing import segment_garment
Performance Issues
Issue: Slow Processing
Solutions:
- Use GPU if available
- Reduce image resolution
- Process in batches
- Pre-load models for reuse
# Pre-load model
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
net = load_cloth_segm_model(device, checkpoint_path)
# Reuse model for multiple images
for image in images:
result = extract_garment(image, net=net, device=device)
Dependency Conflicts
Issue: Version Conflicts
Solution: Use conda environment:
conda env create -f environment.yml
conda activate opentryon
Still Having Issues?
- Check GitHub Issues
- Join Discord
- Open a new issue with:
- Error message
- Python version
- OpenTryOn version
- Steps to reproduce