Skip to content

Instantly share code, notes, and snippets.

View muellerzr's full-sized avatar

Zach Mueller muellerzr

View GitHub Profile
@muellerzr
muellerzr / pr_template.md
Created April 5, 2022 20:10
My personal PR template that I'll be experimenting with for the next few months

{feature_name}

What does this add?

{summary}

Who is it for?

{audience/issues closed}

import torch_xla.core.xla_model as xm
import torch_xla.core.xla_env_vars as xenv
import os
def main(args=None):
print("I did something!")
if os.getenv(xenv.HOST_WORLD_SIZE, None) and xm.xrt_world_size() > 1:
xm.rendezvous("checking_out")
if __name__ == "__main__":
@muellerzr
muellerzr / xla_scriptv2.py
Last active November 8, 2022 02:04
Second version
import torch_xla.distributed.xla_multiprocessing as xmp
import torch_xla.core.xla_model as xm
def _mp_fn(index):
print("I did something!")
xm.rendezvous('checking_out')
if __name__ == "__main__":
xmp.spawn(_mp_fn, args=(), nprocs=8)
@muellerzr
muellerzr / train_test_discrepancy.ipynb
Created June 22, 2022 02:06
Testing the Train/Test Time Discrepancy
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
# Copyright 2021 The HuggingFace 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
#
@muellerzr
muellerzr / memory_issue.ipynb
Created June 10, 2022 18:40
Colab memory issue
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@muellerzr
muellerzr / lr_find_issue.ipynb
Last active May 19, 2022 21:27
Issue with LR Finder
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@muellerzr
muellerzr / torchscript_testing.ipynb
Last active May 14, 2022 14:39
Testing torchscript vs different inference modes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@muellerzr
muellerzr / integration.py
Last active May 11, 2022 04:32
An integration of HuggingFace's Accelerate with fastai
# fastai integration of Accelerate
from accelerate import Accelerator
from fastai.callback.core import Callback, CancelBatchException, CancelStepException
from fastai.learner import Learner, Metric
from fastai.metrics import AccumMetric
from fastai.optimizer import Optimizer, _update
from fastai.distributed import DistributedDL
from fastai.torch_core import to_device
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.