Skip to content

Instantly share code, notes, and snippets.

View muellerzr's full-sized avatar

Zach Mueller muellerzr

View GitHub Profile
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 / 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
@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}

@muellerzr
muellerzr / TestNb.ipynb
Created March 11, 2022 18:22
Rich issues
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@muellerzr
muellerzr / ghapi_create_issue.py
Created February 17, 2022 01:38
Helpful template I used for creating github issues pragmatically on a stream using ghapi
# Import ghapi, install with pip install ghapi
from ghapi.all import GhApi
# Tags for Issue, in this case it was difficulty levels
beg, mod, adv, exp = "Beginner,Moderate,Advanced,Expert".split(',')
# Template for writing start of issue information
def base_issue_template(nb_name, nb_url):
s = f"Add docments to [{nb_name}]({nb_url})\n\n"
s += f"See the [style guide]({style_guide_url}) and [contribution guide]({contrib_guide_url})"