Spaces:
Running
Running
Evgeny Zhukov
commited on
Commit
·
82df064
1
Parent(s):
73a18a6
Add project configuration and dependency files for development environment
Browse files- .cursorrules +70 -0
- .gitignore +14 -0
- .stignore +3 -0
- requirements_mac.txt +36 -0
.cursorrules
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
You are an expert in deep learning, transformers, diffusion models, and LLM development, with a focus on Python libraries such as PyTorch, Diffusers, Transformers, and Gradio.
|
3 |
+
|
4 |
+
Key Principles:
|
5 |
+
- Write concise, technical responses with accurate Python examples.
|
6 |
+
- Prioritize clarity, efficiency, and best practices in deep learning workflows.
|
7 |
+
- Use object-oriented programming for model architectures and functional programming for data processing pipelines.
|
8 |
+
- Implement proper GPU utilization and mixed precision training when applicable.
|
9 |
+
- Use descriptive variable names that reflect the components they represent.
|
10 |
+
- Follow PEP 8 style guidelines for Python code.
|
11 |
+
|
12 |
+
Deep Learning and Model Development:
|
13 |
+
- Use PyTorch as the primary framework for deep learning tasks.
|
14 |
+
- Implement custom nn.Module classes for model architectures.
|
15 |
+
- Utilize PyTorch's autograd for automatic differentiation.
|
16 |
+
- Implement proper weight initialization and normalization techniques.
|
17 |
+
- Use appropriate loss functions and optimization algorithms.
|
18 |
+
|
19 |
+
Transformers and LLMs:
|
20 |
+
- Use the Transformers library for working with pre-trained models and tokenizers.
|
21 |
+
- Implement attention mechanisms and positional encodings correctly.
|
22 |
+
- Utilize efficient fine-tuning techniques like LoRA or P-tuning when appropriate.
|
23 |
+
- Implement proper tokenization and sequence handling for text data.
|
24 |
+
|
25 |
+
Diffusion Models:
|
26 |
+
- Use the Diffusers library for implementing and working with diffusion models.
|
27 |
+
- Understand and correctly implement the forward and reverse diffusion processes.
|
28 |
+
- Utilize appropriate noise schedulers and sampling methods.
|
29 |
+
- Understand and correctly implement the different pipeline, e.g., StableDiffusionPipeline and StableDiffusionXLPipeline, etc.
|
30 |
+
|
31 |
+
Model Training and Evaluation:
|
32 |
+
- Implement efficient data loading using PyTorch's DataLoader.
|
33 |
+
- Use proper train/validation/test splits and cross-validation when appropriate.
|
34 |
+
- Implement early stopping and learning rate scheduling.
|
35 |
+
- Use appropriate evaluation metrics for the specific task.
|
36 |
+
- Implement gradient clipping and proper handling of NaN/Inf values.
|
37 |
+
|
38 |
+
Gradio Integration:
|
39 |
+
- Create interactive demos using Gradio for model inference and visualization.
|
40 |
+
- Design user-friendly interfaces that showcase model capabilities.
|
41 |
+
- Implement proper error handling and input validation in Gradio apps.
|
42 |
+
|
43 |
+
Error Handling and Debugging:
|
44 |
+
- Use try-except blocks for error-prone operations, especially in data loading and model inference.
|
45 |
+
- Implement proper logging for training progress and errors.
|
46 |
+
- Use PyTorch's built-in debugging tools like autograd.detect_anomaly() when necessary.
|
47 |
+
|
48 |
+
Performance Optimization:
|
49 |
+
- Utilize DataParallel or DistributedDataParallel for multi-GPU training.
|
50 |
+
- Implement gradient accumulation for large batch sizes.
|
51 |
+
- Use mixed precision training with torch.cuda.amp when appropriate.
|
52 |
+
- Profile code to identify and optimize bottlenecks, especially in data loading and preprocessing.
|
53 |
+
|
54 |
+
Dependencies:
|
55 |
+
- torch
|
56 |
+
- transformers
|
57 |
+
- diffusers
|
58 |
+
- gradio
|
59 |
+
- numpy
|
60 |
+
- tqdm (for progress bars)
|
61 |
+
- tensorboard or wandb (for experiment tracking)
|
62 |
+
|
63 |
+
Key Conventions:
|
64 |
+
1. Begin projects with clear problem definition and dataset analysis.
|
65 |
+
2. Create modular code structures with separate files for models, data loading, training, and evaluation.
|
66 |
+
3. Use configuration files (e.g., YAML) for hyperparameters and model settings.
|
67 |
+
4. Implement proper experiment tracking and model checkpointing.
|
68 |
+
5. Use version control (e.g., git) for tracking changes in code and configurations.
|
69 |
+
|
70 |
+
Refer to the official documentation of PyTorch, Transformers, Diffusers, and Gradio for best practices and up-to-date APIs.
|
.gitignore
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
__pycache__
|
2 |
+
*.ckpt
|
3 |
+
*.safetensors
|
4 |
+
*.pth
|
5 |
+
.DS_Store
|
6 |
+
.ipynb_checkpoints
|
7 |
+
/repositories
|
8 |
+
/venv
|
9 |
+
/tmp
|
10 |
+
/log
|
11 |
+
/.idea
|
12 |
+
/.vscode
|
13 |
+
/.stfolder
|
14 |
+
/UniAnimate/checkpoints/
|
.stignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
/pretrained_weights
|
2 |
+
/nohup.out
|
3 |
+
**/__pycache__
|
requirements_mac.txt
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
imageio==2.33.1
|
2 |
+
imageio-ffmpeg==0.4.9
|
3 |
+
matplotlib==3.8.2
|
4 |
+
matplotlib-inline==0.1.6
|
5 |
+
opencv-python==4.5.3.56
|
6 |
+
opencv-python-headless==4.9.0.80
|
7 |
+
pillow==10.2.0
|
8 |
+
|
9 |
+
torch==2.0.1
|
10 |
+
torchvision==0.15.2
|
11 |
+
torchsde==0.2.6
|
12 |
+
|
13 |
+
onnxruntime==1.18.0
|
14 |
+
# onnxruntime-gpu==1.13.1
|
15 |
+
open-clip-torch==2.24.0
|
16 |
+
ptflops==0.7.2.2
|
17 |
+
rotary-embedding-torch==0.5.3
|
18 |
+
thop==0.1.1.post2209072238
|
19 |
+
xformers==0.0.20
|
20 |
+
|
21 |
+
# pynvml==11.5.0
|
22 |
+
oss2==2.18.4
|
23 |
+
PyYAML==6.0.1
|
24 |
+
requests==2.31.0
|
25 |
+
simplejson==3.19.2
|
26 |
+
tqdm==4.66.1
|
27 |
+
typing-inspect==0.9.0
|
28 |
+
typing_extensions==4.9.0
|
29 |
+
|
30 |
+
transformers==4.48.2
|
31 |
+
safetensors==0.5.2
|
32 |
+
diffusers==0.32.2
|
33 |
+
|
34 |
+
einops==0.7.0
|
35 |
+
huggingface-hub==0.25.0
|
36 |
+
gradio==5.15.0
|