Git Product home page Git Product logo

huggingface_transformers's Introduction

HuggingFace Pretrained Large Language Models

Conda Environment Setup

conda create -n HF python=3.7
conda activate HF
pip install torch 
pip install git+https://github.com/huggingface/transformers
pip install datasets accelerate evaluate scikit-learn

Download Models/Tokenizer + FineTuning (using single GPU, multple GPUs)

HuggingFace_Transformers
├── BERT_110M
│   ├── download_models.py
│   ├── finetune.sh
│   └── run_mlm.py
├── BERT_340M
│   ├── download_models.py
│   ├── finetune.sh
│   └── run_mlm.py
├── GPT2_124M
│   ├── download_models.py
│   ├── finetune.sh
│   ├── gen.py
│   └── run_clm.py
├── GPT2_1.5B
│   ├── download_models.py
│   ├── finetune.sh
│   └── run_clm.py
├── GPT2_355M
│   ├── download_models.py
│   ├── finetune.sh
│   └── run_clm.py
└── GPT2_774M
    ├── download_models.py
    ├── finetune.sh
    └── run_clm.py

BERT fine-tuning using run_mlm.py (Masked Language Model)

### Tested on 2 x 12GB memory GPUs (NVIDIA TITAN V)

BERT 110M='bert-base-uncased'
#############################
run over 1 x 12G GPUs => consumed 4 GB over one GPUs
run over 2 x 12G GPUs => consumed 6 GB over 2 GPUs

BERT 340M='bert-large-uncased'
#############################
run over 1 x 12G GPUs => consumed 8.5 GB over one GPUs
run over 2 x 12G GPUs => consumed 13 GB over 2 GPUs

GPT2 fine-tuning using run_clm.py (Causal Language Model)

### Tested on 2 x 12GB memory GPUs (NVIDIA TITAN V)

GPT2_124M
#########
run over 1 x 12G GPUs => consumed 8GB over one GPU
run over 2 x 12G GPUs => consumed 10GB over 2 GPUs


GPT2_355M
#########
CAN'T FIT MODEL 
torch.cuda.OutOfMemoryError: CUDA out of memory. 
Tried to allocate 16.00 MiB 
(GPU 0; 11.78 GiB total capacity; 
         8.08 GiB already allocated; 
         12.19 MiB free; 
         8.10 GiB reserved in total by PyTorch) 
If reserved memory is >> allocated memory 
try setting max_split_size_mb to avoid fragmentation.  
See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

GPT2_774M
#########
CAN'T FIT MODEL 
torch.cuda.OutOfMemoryError: CUDA out of memory. 
Tried to allocate 20.00 MiB 
(GPU 0; 11.78 GiB total capacity; 
         6.76 GiB already allocated; 
         2.19 MiB free; 
         6.81 GiB reserved in total by PyTorch) 
If reserved memory is >> allocated memory 
try setting max_split_size_mb to avoid fragmentation.  
See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

GPT2_1.5B
#########
CAN'T FIT MODEL 
torch.cuda.OutOfMemoryError: CUDA out of memory. 
Tried to allocate 100.00 MiB 
(GPU 0; 11.78 GiB total capacity; 
        10.51 GiB already allocated; 
        39.69 MiB free; 
        10.62 GiB reserved in total by PyTorch) 
If reserved memory is >> allocated memory 
try setting max_split_size_mb to avoid fragmentation.  
See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF



huggingface_transformers's People

Contributors

ipark-sjsu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.