Skip to content

Instantly share code, notes, and snippets.

"""
This is a test network moe with gradient checkpointing.
There are three blocks, all wrapped with gradient checkpointing.
The first block only contains a router and the "original layer".
The other two blocks contain the "original layer", and two expert layers.
We have two setups, one where the router scores are returned by the block's forward method and passed down to the other blocks.
The second setup is where the router scores are set directly on the last two blocks as attributes. They are then to be used in the forward method of the expert aggregator of the last two blocks.
"""
import pytest
"""
This is a test network moe with gradient checkpointing.
There are three blocks, all wrapped with gradient checkpointing.
The first block only contains a router and the "original layer".
The other two blocks contain the "original layer", and two expert layers.
We have two setups, one where the router scores are returned by the block's forward method and passed down to the other blocks.
The second setup is where the router scores are set directly on the last two blocks as attributes. They are then to be used in the forward method of the expert aggregator of the last two blocks.
"""
import pytest
@simon-lund
simon-lund / App.tsx
Created January 13, 2023 18:35
Example for useLazyRecoilValue hook
import React, {useEffect, useState} from 'react';
import './App.css';
import {atom, RecoilState, useRecoilValueLoadable} from "recoil";
const data: string[] = [
"Go on a hike",
"Visit a new city",
"Try a new type of food",
"Take a dance class",
"Go stargazing",