This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch.nn as nn | |
from datasets import load_dataset | |
from transformers import ( | |
AutoModelForCausalLM, | |
AutoTokenizer, | |
DataCollatorForLanguageModeling, | |
Trainer, | |
TrainingArguments, | |
set_seed, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compute_environment: LOCAL_MACHINE | |
debug: false | |
distributed_type: FSDP | |
downcast_bf16: 'no' | |
enable_cpu_affinity: false | |
fsdp_config: | |
fsdp_activation_checkpointing: false | |
fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP | |
fsdp_backward_prefetch: BACKWARD_PRE | |
fsdp_cpu_ram_efficient_loading: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from transformers import AutoTokenizer, LlamaForCausalLM | |
from accelerate.utils import set_seed | |
set_seed(42) | |
file_size = 132 # 70B | |
# file_size = 30 # 8B | |
start_time = time.time() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to GitHub Pages | |
on: | |
push: | |
branches: [ "main", "master" ] | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[P2P (Peer-to-Peer) GPU Bandwidth Latency Test] | |
Device: 0, NVIDIA GeForce RTX 4090, pciBusID: 1, pciDeviceID: 0, pciDomainID:0 | |
Device: 1, NVIDIA GeForce RTX 4090, pciBusID: 2, pciDeviceID: 0, pciDomainID:0 | |
Device=0 CANNOT Access Peer Device=1 | |
Device=1 CANNOT Access Peer Device=0 | |
***NOTE: In case a device doesn't have P2P access to other one, it falls back to normal memcopy procedure. | |
So you can see lesser Bandwidth (GB/s) and unstable Latency (us) in those cases. | |
P2P Connectivity Matrix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import builtins | |
import fcntl | |
import os | |
import socket | |
import torch | |
import torch.distributed as dist | |
print("STARTED") | |
def print(*args, **kwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from transformers import AutoModel, AutoConfig, AutoModelForSequenceClassification | |
def get_model_memory(model: torch.nn.Module): | |
""" | |
Returns the memory usage of the given model | |
""" | |
total_memory = 0 | |
for param in model.parameters(): | |
total_memory += param.numel() * param.element_size() |
NewerOlder