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 os, torch, torch.multiprocessing as mp | |
from transformers import AutoModelForCausalLM, LlamaConfig | |
CHECK_EQUAL_WITH_HF = '' # A pretrain directory eg. '/data/models/llama-2-hf/7b-chat' | |
def add_arguments(parser): | |
group = parser.add_argument_group(title='Llama-2 HF saver.') | |
group.add_argument('--megatron-path', type=str, default=None, | |
help='Base directory of megatron checkpoint') |
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
#include <algorithm> | |
#include <cstring> | |
#include <fstream> | |
#include <iostream> | |
template<typename _Stream> | |
size_t GetFileSize(_Stream &stream) { | |
auto nCurPos = stream.tellg(); | |
stream.seekg(0, std::ios::end); | |
auto nFileSize = stream.tellg(); |
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
#! /bin/bash -e | |
export TOOLCHAIN_ROOT="/heop/.tool/toolchain/arm-ca9-linux-gnueabihf-6.5" | |
export PATH=$TOOLCHAIN_ROOT/bin:$PATH | |
export CPPFLAGS="--sysroot=$TOOLCHAIN_ROOT/arm-ca9-linux-gnueabihf/sysroot" | |
export AR=arm-linux-ar | |
export AS=arm-linux-as | |
export LD=arm-linux-ld | |
export RANLIB=arm-linux-ranlib | |
export CC=arm-linux-gcc |
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
#!/bin/bash -e | |
export TOOLCHAIN_ROOT=/heop/.tool/toolchain/arm-ca9-linux-gnueabihf-6.5 | |
export SYSROOT=$TOOLCHAIN_ROOT/arm-ca9-linux-gnueabihf/sysroot | |
export CC=$TOOLCHAIN_ROOT/bin/arm-linux-gcc | |
export CXX=$TOOLCHAIN_ROOT/bin/arm-linux-g++ | |
export AR=$TOOLCHAIN_ROOT/bin/arm-linux-ar | |
export RANLIB=$TOOLCHAIN_ROOT/bin/arm-linux-ranlib | |
mkdir -p build |
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
下载镜像: | |
docker pull <IMAGE_NAME> # https://hub.docker.com/r/nvidia/cuda | |
列出所有镜像 | |
docker images | |
运行镜像(运行为一个容器) |
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
#include "NvEncoder/NvEncoderCuda.h" | |
#include "NvEncoder/NvEncoderCLIOptions.h" | |
#include "NvEncoder/NvCodecUtils.h" | |
#include <cuda_runtime.h> | |
extern "C" { | |
#include <libavutil/opt.h> | |
#include <libavcodec/avcodec.h> | |
#include <libavformat/avformat.h> | |
} |
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 (C) DeepGlint, Inc - All Rights Reserved | |
* Unauthorized copying of this file, via any medium is strictly prohibited | |
* Proprietary and confidential | |
* | |
* CTimer for Code Profile | |
* | |
* Written by Devymex <yumengwang@deepglint.com>, Jan. 2019 | |
*/ |
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 | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import torch.utils.checkpoint as checkpoint | |
import numpy as np | |
import math | |
def drop_path(x, drop_prob: float = 0., training: bool = False, scale_by_keep: bool = True): | |
"""Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). | |
This is the same as the DropConnect impl I created for EfficientNet, etc networks, however, |
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
#!/bin/bash -e | |
if [ $# -eq 0 ]; then | |
echo "Please specify an name for the new container!" | |
exit | |
fi | |
indices="" | |
for cid in $(docker container ls -a | sed 1,1d | awk '{print $1}'); do | |
port=$(docker inspect --format='{{if .NetworkSettings.Ports}}{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}{{else}}{{"null"}}{{end}}' $cid) | |
indices=$indices" "$port |
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
FROM nvidia/cuda:11.3.0-cudnn8-devel-ubuntu18.04 | |
RUN mkdir -p /home/root | |
RUN apt update | |
RUN apt upgrade -y | |
RUN apt install -y apt-utils dialog | |
RUN apt install -y bash-completion locate vim tmux unzip htop | |
RUN apt install -y openssh-server # net-tools iputils-ping curl | |
RUN apt install -y build-essential pkg-config gdb git | |
RUN apt install -y libssl-dev libgoogle-glog-dev libgflags-dev |
NewerOlder