Skip to content

Commit

Permalink
[Migration] Move files referencing old names to torchat (pytorch#182)
Browse files Browse the repository at this point in the history
* [Docs] Fix CONTRIBUTING.md to reference torchat

* [Migration] Move files referencing old names to torchat
  • Loading branch information
orionr authored and malfet committed Jul 17, 2024
1 parent 53053d3 commit 89e5b05
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 34 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
fail-fast: false
runs-on: ${{ matrix.runner }}
env:
LLAMA_FAST_ROOT: ${{ github.workspace }}
TORCHAT_ROOT: ${{ github.workspace }}
REPO_NAME: ${{ matrix.repo_name }}
ENABKE_ET_PYBIND: ${{ matrix.runner == 'macos-14' && 'false' || 'true' }}
steps:
Expand All @@ -45,13 +45,13 @@ jobs:
echo "$(uname -a)"
- name: Install dependencies
run: |
bash ${LLAMA_FAST_ROOT}/scripts/install_et.sh $ENABKE_ET_PYBIND
bash ${TORCHAT_ROOT}/scripts/install_et.sh $ENABKE_ET_PYBIND
- name: Download checkpoints
run: |
bash ${LLAMA_FAST_ROOT}/.ci/scripts/wget_checkpoint.sh ${{ matrix.repo_name }} "${{ matrix.resources }}"
bash ${TORCHAT_ROOT}/.ci/scripts/wget_checkpoint.sh ${{ matrix.repo_name }} "${{ matrix.resources }}"
- name: Run validation
run: |
pushd ${LLAMA_FAST_ROOT}
export CHECKPOINT_PATH=${LLAMA_FAST_ROOT}/checkpoints/${REPO_NAME}/model.pth
bash ${LLAMA_FAST_ROOT}/.ci/scripts/convert_checkpoint.sh ${REPO_NAME}
bash ${LLAMA_FAST_ROOT}/.ci/scripts/validate.sh ${CHECKPOINT_PATH}
pushd ${TORCHAT_ROOT}
export CHECKPOINT_PATH=${TORCHAT_ROOT}/checkpoints/${REPO_NAME}/model.pth
bash ${TORCHAT_ROOT}/.ci/scripts/convert_checkpoint.sh ${REPO_NAME}
bash ${TORCHAT_ROOT}/.ci/scripts/validate.sh ${CHECKPOINT_PATH}
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to gpt-fast
# Contributing to torchat
We want to make contributing to this project as easy and transparent as
possible.

Expand Down Expand Up @@ -28,5 +28,5 @@ disclosure of security bugs. In those cases, please go through the process
outlined on that page and do not file a public issue.

## License
By contributing to `gpt-fast`, you agree that your contributions will be licensed
By contributing to `torchat`, you agree that your contributions will be licensed
under the LICENSE file in the root directory of this source tree.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ For convenience, we provide a script that does this for you.

From the torchat root directory, run the following
```
export LLAMA_FAST_ROOT=${PWD}
export TORCHAT_ROOT=${PWD}
./scripts/install_et.sh
```

Expand All @@ -685,7 +685,7 @@ This will create a build directory, git clone ExecuTorch to ./build/src, applies
After ExecuTorch is installed, you can build runner-et from the torchat root directory with the following

```
export LLAMA_FAST_ROOT=${PWD}
export TORCHAT_ROOT=${PWD}
cmake -S ./runner-et -B build/cmake-out -G Ninja
cmake --build ./build/cmake-out
```
Expand Down
2 changes: 1 addition & 1 deletion parking_lot/runner_et.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
pip install zstd
pip install -r requirements.txt
export LLAMA_FAST_ROOT=${PWD}
export TORCHAT_ROOT=${PWD}
export ENABLE_ET_PYBIND=false
./scripts/install_et.sh $ENABLE_ET_PYBIND
cmake -S ./runner-et -B build/cmake-out -G Ninja
Expand Down
14 changes: 7 additions & 7 deletions runner-et/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
cmake_minimum_required(VERSION 3.24)
set(CMAKE_CXX_STANDARD 17)

project(llama-fast)
project(Torchat)

include(CMakePrintHelpers)
set(LLAMA_FAST_ROOT $ENV{LLAMA_FAST_ROOT})
cmake_print_variables(LLAMA_FAST_ROOT)
set(TORCHAT_ROOT $ENV{TORCHAT_ROOT})
cmake_print_variables(TORCHAT_ROOT)

find_package(executorch CONFIG REQUIRED PATHS ${LLAMA_FAST_ROOT}/build/install/lib/cmake/ExecuTorch)
set(_common_include_directories ${LLAMA_FAST_ROOT}/build/src)
find_package(executorch CONFIG REQUIRED PATHS ${TORCHAT_ROOT}/build/install/lib/cmake/ExecuTorch)
set(_common_include_directories ${TORCHAT_ROOT}/build/src)
cmake_print_variables(_common_include_directories)

target_include_directories(executorch INTERFACE ${_common_include_directories}) # Ideally ET installation process would do this
target_include_directories(executorch INTERFACE ${_common_include_directories}) # Ideally ExecuTorch installation process would do this
add_executable(runner_et run.cpp)

# Link ET runtime + extensions
target_link_libraries(
runner_et PRIVATE
executorch
extension_module
${LLAMA_FAST_ROOT}/build/src/executorch/cmake-out/extension/data_loader/libextension_data_loader.a # This one does not get installed by ET
${TORCHAT_ROOT}/build/src/executorch/cmake-out/extension/data_loader/libextension_data_loader.a # This one does not get installed by ExecuTorch
optimized_kernels
portable_kernels
cpublas
Expand Down
12 changes: 6 additions & 6 deletions scripts/android_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

set -eu

cd ${LLAMA_FAST_ROOT}
echo "Inside: $LLAMA_FAST_ROOT"
cd ${TORCHAT_ROOT}
echo "Inside: $TORCHAT_ROOT"

which curl

Expand All @@ -25,8 +25,8 @@ else
exit -1
fi

mkdir -p ${LLAMA_FAST_ROOT}/build/android
pushd ${LLAMA_FAST_ROOT}/build/android
mkdir -p ${TORCHAT_ROOT}/build/android
pushd ${TORCHAT_ROOT}/build/android

echo "Download Java 17"
curl "${JAVA_URL}" -o jdk-17.0.10.tar.gz
Expand Down Expand Up @@ -69,8 +69,8 @@ pushd build/src/executorch/examples/demo-apps/android/LlamaDemo
./gradlew :app:build
popd

avdmanager create avd --name "llama-fast" --package "system-images;android-34;google_apis;${ANDROID_ABI}"
sdk/emulator/emulator @llama-fast &
avdmanager create avd --name "torchat" --package "system-images;android-34;google_apis;${ANDROID_ABI}"
sdk/emulator/emulator @torchat &

adb wait-for-device
adb shell mkdir /data/local/tmp/llama
Expand Down
18 changes: 9 additions & 9 deletions scripts/install_et.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ install_pip_dependencies() {
pip install cmake
pip install ninja
pip install zstd
pushd ${LLAMA_FAST_ROOT}
pushd ${TORCHAT_ROOT}
pip install -r ./requirements.txt
popd
}

install_executorch() {
echo "Cloning executorch to ${LLAMA_FAST_ROOT}/build/src"
rm -rf ${LLAMA_FAST_ROOT}/build
mkdir -p ${LLAMA_FAST_ROOT}/build/src
pushd ${LLAMA_FAST_ROOT}/build/src
echo "Cloning executorch to ${TORCHAT_ROOT}/build/src"
rm -rf ${TORCHAT_ROOT}/build
mkdir -p ${TORCHAT_ROOT}/build/src
pushd ${TORCHAT_ROOT}/build/src
git clone https://github.com/pytorch/executorch.git
cd executorch
echo "Install executorch: submodule update"
git submodule sync
git submodule update --init

echo "Applying fixes"
cp ${LLAMA_FAST_ROOT}/scripts/fixes_et/module.cpp ${LLAMA_FAST_ROOT}/build/src/executorch/extension/module/module.cpp # ET uses non-standard C++ that does not compile in GCC
cp ${LLAMA_FAST_ROOT}/scripts/fixes_et/managed_tensor.h ${LLAMA_FAST_ROOT}/build/src/executorch/extension/runner_util/managed_tensor.h # ET is missing headers for vector/memory. This causes downstream issues when building runner-et.
cp ${TORCHAT_ROOT}/scripts/fixes_et/module.cpp ${TORCHAT_ROOT}/build/src/executorch/extension/module/module.cpp # ET uses non-standard C++ that does not compile in GCC
cp ${TORCHAT_ROOT}/scripts/fixes_et/managed_tensor.h ${TORCHAT_ROOT}/build/src/executorch/extension/runner_util/managed_tensor.h # ET is missing headers for vector/memory. This causes downstream issues when building runner-et.

echo "Building and installing python libraries"
echo "Building and installing python libraries"
Expand All @@ -50,14 +50,14 @@ install_executorch() {
mkdir cmake-out
cmake -DCMAKE_BUILD_TYPE=Release -DEXECUTORCH_BUILD_OPTIMIZED=ON -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON -DEXECUTORCH_BUILD_XNNPACK=ON -S . -B cmake-out -G Ninja
cmake --build cmake-out
cmake --install cmake-out --prefix ${LLAMA_FAST_ROOT}/build/install
cmake --install cmake-out --prefix ${TORCHAT_ROOT}/build/install
popd
}


ENABLE_ET_PYBIND="${1:-true}"

pushd ${LLAMA_FAST_ROOT}
pushd ${TORCHAT_ROOT}
install_pip_dependencies
install_executorch $ENABLE_ET_PYBIND
popd

0 comments on commit 89e5b05

Please sign in to comment.