repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
libai | libai-main/projects/QQP/modeling/load_megatron_weight.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 4,859 | 35 | 100 | py |
libai | libai-main/projects/DALLE2/dalle2_inference.py | import os
from typing import Dict
import oneflow as flow
from dalle2.dalle2_loader import Dalle2ModelLoader
from dalle2.model_weights.download_utils import download_dalle2_weights
from dalle2.tokenizer import SimpleTokenizer
from oneflow.framework import balanced_splitter
import libai.utils.distributed as dist
from l... | 6,770 | 35.6 | 99 | py |
libai | libai-main/projects/DALLE2/dalle2/_clip.py | import os
import sys
from collections import namedtuple
import oneflow as flow
from oneflow import nn
from .models import l2norm
def import_flow_clip(fn):
def wrapper(*args, **kwargs):
sys.path.append(
os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")), "CLIP")
... | 2,932 | 24.068376 | 99 | py |
libai | libai-main/projects/DALLE2/dalle2/utils.py | import importlib
import time
# helper functions
def exists(val):
return val is not None
# time helpers
class Timer:
def __init__(self):
self.reset()
def reset(self):
self.last_time = time.time()
def elapsed(self):
return time.time() - self.last_time
# print helpers
d... | 657 | 14.302326 | 50 | py |
libai | libai-main/projects/DALLE2/dalle2/vqgan_vae.py | import copy
from functools import partial, wraps
from math import sqrt
import flowvision
import oneflow as flow
import oneflow.nn.functional as F
from einops import rearrange, repeat
from oneflow import einsum, nn
from oneflow.autograd import grad as flow_grad
from libai.layers import Linear
from .einops_exts import... | 21,938 | 26.219603 | 100 | py |
libai | libai-main/projects/DALLE2/dalle2/rotary_embedding_flow.py | from inspect import isfunction
from math import pi
import oneflow as flow
from einops import rearrange, repeat
from oneflow import einsum, nn
from libai.utils import distributed as dist
# helper functions
def exists(val):
return val is not None
def broadcat(tensors, dim=-1):
num_tensors = len(tensors)
... | 4,157 | 30.029851 | 96 | py |
libai | libai-main/projects/DALLE2/dalle2/tokenizer.py | # take from https://github.com/openai/CLIP/blob/main/clip/simple_tokenizer.py
# to give users a quick easy start to training DALL-E without doing BPE
import gzip
import html
import os
from functools import lru_cache
from pathlib import Path
import ftfy
import oneflow as flow
import regex as re
from .utils import imp... | 7,011 | 30.872727 | 119 | py |
libai | libai-main/projects/DALLE2/dalle2/dalle2_loader.py | import logging
import oneflow as flow
from oneflow.framework.check_point_v2 import _broadcast_py_object
import libai.utils.distributed as dist
from libai.models.build import build_model
from libai.models.utils.model_loader.base_loader import (
ModelLoaderHuggerFace,
_load_state_dict_into_model,
)
logger = lo... | 3,927 | 39.494845 | 100 | py |
libai | libai-main/projects/DALLE2/dalle2/models.py | import math
import random
from contextlib import contextmanager
from functools import partial, wraps
import flowvision.transforms as T
import kornia.augmentation as K
import numpy as np
import oneflow as flow
import oneflow.nn.functional as F
from einops import rearrange, reduce, repeat
from kornia.filters import gaus... | 83,430 | 31.821007 | 100 | py |
libai | libai-main/projects/DALLE2/dalle2/__init__.py | from .models import Unet, DALLE2, DiffusionPriorNetwork, DiffusionPrior, Decoder
from ._clip import OpenAIClipAdapter, import_flow_clip
| 136 | 44.666667 | 80 | py |
libai | libai-main/projects/DALLE2/dalle2/vector_quantize_flow.py | # from https://github.com/lucidrains/vector_quantize_pytorch/vector_quantize_pytorch.py
import oneflow as flow
import oneflow.nn.functional as F
from einops import rearrange, repeat
from oneflow import einsum, nn
from libai.utils import distributed
def exists(val):
return val is not None
def default(val, d):
... | 19,209 | 30.033926 | 100 | py |
libai | libai-main/projects/DALLE2/dalle2/einops_exts.py | # From https://github.com/arogozhnikov/einops/blob/master/einops/layers/oneflow.py
import re
from functools import wraps
import oneflow as flow
from einops import rearrange, reduce, repeat
from einops._backends import AbstractBackend
from einops.layers import RearrangeMixin
from oneflow import nn
class Rearrange(Re... | 5,044 | 28.852071 | 90 | py |
libai | libai-main/projects/DALLE2/dalle2/model_weights/download_utils.py | import logging
import os
from libai.utils.file_utils import download_file
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
url_map = {
"prior": "https://huggingface.co/nousr/conditioned-prior/resolve/main/vit-l-14/prior_aes_finetune.pth", # noqa
"decoder": "https://huggingface.co/laion/D... | 1,649 | 42.421053 | 146 | py |
libai | libai-main/projects/DALLE2/configs/dalle2_config.py | from libai.config import LazyCall
from configs.common.train import train
from dalle2.models import DiffusionPrior, DiffusionPriorNetwork, Unet, Decoder, DALLE2
from dalle2._clip import OpenAIClipAdapter
from omegaconf import DictConfig
clip = LazyCall(OpenAIClipAdapter)(name="")
swinir = DictConfig({"swinir_path": Non... | 1,532 | 21.217391 | 86 | py |
libai | libai-main/projects/DALLE2/swinir/utils.py | # -----------------------------------------------------------------------------------
# from
# https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/layers/weight_init.py
# -----------------------------------------------------------------------------------
import collections.abc
import math
import w... | 5,374 | 39.413534 | 99 | py |
libai | libai-main/projects/DALLE2/swinir/models.py | # -----------------------------------------------------------------------------------
# SwinIR: Image Restoration Using Swin Transformer, https://arxiv.org/abs/2108.10257
# Originally Written by Ze Liu, Modified by Jingyun Liang.
# -----------------------------------------------------------------------------------
# co... | 37,112 | 34.823359 | 100 | py |
libai | libai-main/projects/DALLE2/swinir/__init__.py | from .models import SwinIR
from .upsample import load_model, upsample4x, upsample16x
| 85 | 27.666667 | 57 | py |
libai | libai-main/projects/DALLE2/swinir/upsample.py | import os
import oneflow as flow
import requests
from .models import SwinIR as net
def load_torch_weight(model, model_path):
# load torch weight
import torch
param_key_g = "params_ema"
pretrained_model = torch.load(model_path, map_location="cpu")
pretrained_model = (
pretrained_model[pa... | 2,486 | 28.607143 | 88 | py |
libai | libai-main/projects/BLOOM/configs/bloom_inference.py | from omegaconf import DictConfig
from libai.config import LazyCall
from projects.BLOOM.modeling.bloom_model import BloomModel
cfg = dict(
# model
vocab_size=250880,
hidden_size=64,
hidden_layers=2,
n_head=8,
padding_idx=3,
layer_norm_epsilon=1e-5,
initializer_range=0.02,
apply_resi... | 1,303 | 21.877193 | 58 | py |
libai | libai-main/projects/BLOOM/utils/model_loader.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 2,934 | 34.792683 | 92 | py |
libai | libai-main/projects/BLOOM/modeling/activation.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
# Copyright 2022 The HuggingFace Inc. team.
#
# 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... | 2,621 | 30.590361 | 97 | py |
libai | libai-main/projects/BLOOM/modeling/transformers.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
# Copyright 2022 The HuggingFace Inc. team.
#
# 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... | 4,242 | 30.664179 | 99 | py |
libai | libai-main/projects/BLOOM/modeling/mlp.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
# Copyright 2022 The HuggingFace Inc. team.
#
# 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... | 2,716 | 33.833333 | 95 | py |
libai | libai-main/projects/BLOOM/modeling/bloom_model.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
# Copyright 2022 The HuggingFace Inc. team.
#
# 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... | 15,297 | 35.080189 | 110 | py |
libai | libai-main/projects/BLOOM/modeling/attention.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
# Copyright 2022 The HuggingFace Inc. team.
#
# 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... | 7,869 | 33.669604 | 100 | py |
libai | libai-main/projects/BLOOM/modeling/mask.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
# Copyright 2022 The HuggingFace Inc. team.
#
# 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... | 3,662 | 35.63 | 86 | py |
libai | libai-main/projects/T5/models/embedding.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 4,527 | 34.936508 | 95 | py |
libai | libai-main/projects/T5/models/logits.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 1,958 | 35.962264 | 96 | py |
libai | libai-main/projects/T5/models/t5_model.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 14,346 | 40.585507 | 96 | py |
libai | libai-main/projects/T5/models/mlp.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 3,696 | 27.658915 | 74 | py |
libai | libai-main/projects/T5/models/transformer_layer.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 9,934 | 38.268775 | 99 | py |
libai | libai-main/projects/T5/models/layer_norm.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 1,324 | 34.810811 | 99 | py |
libai | libai-main/projects/T5/models/attention.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 14,317 | 39.792023 | 100 | py |
libai | libai-main/projects/T5/datasets/dataset.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 10,558 | 40.735178 | 98 | py |
libai | libai-main/projects/T5/configs/optim.py | import oneflow as flow
from libai.optim import get_default_optimizer_params
from libai.config import LazyCall
optim = LazyCall(flow.optim.AdamW)(
params=LazyCall(get_default_optimizer_params)(
# params.model is meant to be set to the model object,
# before instantiating the optimizer.
clip... | 547 | 25.095238 | 62 | py |
libai | libai-main/projects/T5/configs/t5_model_config.py | from omegaconf import DictConfig
cfg = dict(
vocab_size=30522,
hidden_size=768,
hidden_layers=6,
num_attention_heads=12,
head_size=64,
intermediate_size=1536,
hidden_dropout_prob=0.1,
attention_probs_dropout_prob=0.1,
relative_attention_num_buckets=32,
embedding_dropout_prob=0.... | 444 | 19.227273 | 38 | py |
libai | libai-main/projects/T5/configs/mt5_pretrain.py | from libai import evaluation
from libai.data.build import build_nlp_train_loader
from omegaconf import OmegaConf
from libai.config import LazyCall
from libai.evaluation import PPLEvaluator, evaluator
from libai.scheduler import WarmupExponentialLR
from configs.common.train import train
from configs.common.models.grap... | 2,566 | 26.902174 | 73 | py |
libai | libai-main/projects/T5/utils/weight_convert.py | import argparse
import oneflow as flow
import torch
from libai.config import LazyConfig
def parse_args():
parser = argparse.ArgumentParser(description="MT5 Weight Convertor")
parser.add_argument(
"--oneflow_state_dict_path", type=str, help="The path of mt5's checkpoint in LiBai"
)
parser.add... | 10,611 | 47.678899 | 99 | py |
libai | libai-main/projects/T5/utils/mask.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 2,225 | 33.78125 | 91 | py |
libai | libai-main/projects/MagicPrompt/gpt2.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 17,127 | 38.740139 | 100 | py |
libai | libai-main/projects/MagicPrompt/pipeline.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 3,639 | 32.703704 | 94 | py |
libai | libai-main/projects/MagicPrompt/datasets/datasets.py | import os
def convert_txt2json(file_path):
"""Store the dataset in loose JSON format file, you can refer:
https://libai.readthedocs.io/en/latest/tutorials/basics/Preprocessing_Dataset.html
"""
filename, ext = os.path.splitext(file_path)
filename = filename.split("/")[-1]
with open(file_path) ... | 848 | 31.653846 | 95 | py |
libai | libai-main/projects/MagicPrompt/layers/transformer_layer.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 10,211 | 39.685259 | 99 | py |
libai | libai-main/projects/MagicPrompt/layers/__init__.py | 0 | 0 | 0 | py | |
libai | libai-main/projects/MagicPrompt/layers/attention_layer.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 11,880 | 40.982332 | 99 | py |
libai | libai-main/projects/MagicPrompt/configs/gpt2_dataset.py | from libai.config import LazyCall
from libai.data import build_nlp_train_val_test_loader
from configs.common.data.gpt_dataset import tokenization, dataloader
from libai.tokenizer import GPT2Tokenizer
from libai.data.datasets import GPT2Dataset
from libai.data.data_utils import get_indexed_dataset
data_prefix = "/data... | 1,185 | 30.210526 | 72 | py |
libai | libai-main/projects/MagicPrompt/configs/gpt2_training.py | from libai.config import LazyCall
from libai.evaluation import PPLEvaluator
from projects.MagicPrompt.configs.gpt2_inference import pretrain_model as model
from projects.MagicPrompt.configs.gpt2_dataset import dataloader, tokenization
from configs.common.optim import optim
from libai.scheduler import WarmupExponential... | 2,667 | 30.761905 | 79 | py |
libai | libai-main/projects/MagicPrompt/configs/gpt2_inference.py | from configs.common.models.gpt import cfg
from libai.config import LazyCall
from projects.mock_transformers import mock_tokenization
from projects.MagicPrompt.gpt2 import GPTModel, GPTForPreTraining
from configs.common.data.gpt_dataset import tokenization
from configs.common.train import train
cfg.update(
# Model... | 1,879 | 26.246377 | 67 | py |
libai | libai-main/projects/Stable_Diffusion/modeling.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 6,819 | 41.360248 | 98 | py |
libai | libai-main/projects/Stable_Diffusion/dataset.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 6,839 | 35.190476 | 100 | py |
libai | libai-main/projects/Stable_Diffusion/generate_prior_image.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 4,744 | 31.951389 | 99 | py |
libai | libai-main/projects/Stable_Diffusion/train_net.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 5,384 | 35.385135 | 98 | py |
libai | libai-main/projects/Stable_Diffusion/configs/lora_config.py | from omegaconf import OmegaConf
from libai.config import get_config
from libai.config import LazyCall
from libai.data.build import build_nlp_train_loader, build_nlp_test_loader
from projects.Stable_Diffusion.dataset import DreamBoothDataset
from projects.Stable_Diffusion.modeling import StableDiffusion
from transforme... | 1,799 | 28.032258 | 99 | py |
libai | libai-main/projects/Stable_Diffusion/configs/prior_preservation_config.py | from omegaconf import OmegaConf
import oneflow as flow
from libai.optim import get_default_optimizer_params
from libai.config import LazyCall
from libai.data.build import build_nlp_train_loader, build_nlp_test_loader
from projects.Stable_Diffusion.dataset import DreamBoothDataset
from transformers import CLIPTokenize... | 993 | 25.864865 | 87 | py |
libai | libai-main/projects/Stable_Diffusion/configs/dreambooth_config.py | from omegaconf import OmegaConf
from libai.config import get_config
from libai.config import LazyCall
from libai.data.build import build_nlp_train_loader, build_nlp_test_loader
from projects.Stable_Diffusion.dataset import DreamBoothDataset
from projects.Stable_Diffusion.modeling import StableDiffusion
from transforme... | 1,777 | 27.677419 | 87 | py |
libai | libai-main/projects/Stable_Diffusion/configs/config.py | from omegaconf import OmegaConf
from libai.config import get_config
from libai.config import LazyCall
from libai.data.build import build_nlp_train_loader, build_nlp_test_loader
from projects.Stable_Diffusion.dataset import TXTDataset
from projects.Stable_Diffusion.modeling import StableDiffusion
from transformers impo... | 1,693 | 27.233333 | 87 | py |
libai | libai-main/tests/test_trainer.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 3,870 | 26.06993 | 92 | py |
libai | libai-main/tests/test_file_io.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 12,018 | 37.155556 | 95 | py |
libai | libai-main/tests/__init__.py | 0 | 0 | 0 | py | |
libai | libai-main/tests/test_scheduler.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 6,402 | 31.015 | 97 | py |
libai | libai-main/tests/test_optim.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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... | 2,519 | 39 | 96 | py |
libai | libai-main/tests/fixtures/utils.py | from libai.utils.download import download
fixtrue_urls = {
"sample_text.txt": "https://oneflow-static.oss-cn-beijing.aliyuncs.com/ci-files/dataset/libai/fixtures/sample_text.txt", # noqa
"spiece.model": "https://oneflow-static.oss-cn-beijing.aliyuncs.com/ci-files/dataset/libai/fixtures/spiece.model", # noqa
... | 773 | 44.529412 | 150 | py |
libai | libai-main/tests/config/test_lazy_config.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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... | 3,540 | 33.378641 | 89 | py |
libai | libai-main/tests/config/test_instantiate_config.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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... | 4,865 | 31.657718 | 96 | py |
libai | libai-main/tests/config/root_cfg.py | # Copyright (c) Facebook, Inc. and its affiliates.
from itertools import count
from libai.config import LazyCall
from .dir1.dir1_a import dir1a_dict, dir1a_str
dir1a_dict.a = "modified"
# modification above won't affect future imports
from .dir1.dir1_b import dir1b_dict, dir1b_str
lazyobj = LazyCall(count)(x=dir1... | 340 | 21.733333 | 51 | py |
libai | libai-main/tests/config/dir1/dir1_a.py | # Copyright (c) Facebook, Inc. and its affiliates.
dir1a_str = "base_a_1"
dir1a_dict = {"a": 1, "b": 2}
| 104 | 25.25 | 50 | py |
libai | libai-main/tests/config/dir1/dir1_b.py | # Copyright (c) Facebook, Inc. and its affiliates.
from libai.config import LazyConfig
# equivalent to relative import
dir1a_str, dir1a_dict = LazyConfig.load_rel("dir1_a.py", ("dir1a_str", "dir1a_dict"))
dir1b_str = dir1a_str + "_from_b"
dir1b_dict = dir1a_dict
# Every import is a reload: not modified by other conf... | 354 | 28.583333 | 85 | py |
libai | libai-main/tests/models/test_vit.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 6,402 | 34.77095 | 125 | py |
libai | libai-main/tests/models/test_swin.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 6,399 | 34.955056 | 125 | py |
libai | libai-main/tests/models/test_swinv2.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 6,421 | 35.078652 | 125 | py |
libai | libai-main/tests/models/test_mt5.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 7,176 | 36.186528 | 145 | py |
libai | libai-main/tests/models/test_bert.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 6,735 | 36.422222 | 145 | py |
libai | libai-main/tests/models/test_roberta.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 7,129 | 37.540541 | 147 | py |
libai | libai-main/tests/models/__init__.py | 0 | 0 | 0 | py | |
libai | libai-main/tests/models/test_gpt.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 7,701 | 36.754902 | 145 | py |
libai | libai-main/tests/models/test_t5.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 7,161 | 36.108808 | 145 | py |
libai | libai-main/tests/tokenizer/test_tokenization_roberta.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 3,451 | 34.22449 | 98 | py |
libai | libai-main/tests/tokenizer/test_tokenization_common.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 16,794 | 40.882793 | 96 | py |
libai | libai-main/tests/tokenizer/test_tokenization_bert.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 5,007 | 30.696203 | 97 | py |
libai | libai-main/tests/tokenizer/test_tokenization_gpt2.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 3,028 | 33.033708 | 95 | py |
libai | libai-main/tests/tokenizer/__init__.py | 0 | 0 | 0 | py | |
libai | libai-main/tests/tokenizer/test_tokenization_t5.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 5,168 | 32.134615 | 98 | py |
libai | libai-main/tests/model_loader/test_mt5_loader.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 7,293 | 33.899522 | 151 | py |
libai | libai-main/tests/model_loader/test_t5_loader.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 7,282 | 33.84689 | 150 | py |
libai | libai-main/tests/model_loader/test_roberta_loader.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 6,023 | 34.64497 | 155 | py |
libai | libai-main/tests/model_loader/test_gpt_loader.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 8,936 | 32.724528 | 151 | py |
libai | libai-main/tests/model_loader/test_swin_loader.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 7,713 | 34.223744 | 152 | py |
libai | libai-main/tests/model_loader/test_vit_loader.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 7,553 | 33.493151 | 151 | py |
libai | libai-main/tests/model_loader/test_bert_loader.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 5,969 | 34.325444 | 152 | py |
libai | libai-main/tests/model_loader/__init__.py | 0 | 0 | 0 | py | |
libai | libai-main/tests/model_loader/test_swinv2_loader.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 7,819 | 34.067265 | 154 | py |
libai | libai-main/tests/layers/test_trainer_model.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 2,247 | 31.114286 | 74 | py |
libai | libai-main/tests/layers/test_evaluator_model.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 1,653 | 28.535714 | 74 | py |
libai | libai-main/tests/layers/test_linear.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 4,370 | 37.008696 | 98 | py |
libai | libai-main/tests/layers/__init__.py | 0 | 0 | 0 | py | |
libai | libai-main/tests/data/test_sampler.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 6,458 | 32.293814 | 97 | py |
libai | libai-main/tests/data/__init__.py | 0 | 0 | 0 | py | |
libai | libai-main/tests/inference/test_text_generation.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 3,903 | 40.094737 | 136 | py |
libai | libai-main/tests/inference/test_image_classification.py | # coding=utf-8
# Copyright 2021 The OneFlow Authors. 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
#
# Unless require... | 4,163 | 42.831579 | 134 | py |
libai | libai-main/tests/inference/__init__.py | 0 | 0 | 0 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.