file_path
stringlengths
3
280
file_language
stringclasses
66 values
content
stringlengths
1
1.04M
repo_name
stringlengths
5
92
repo_stars
int64
0
154k
repo_description
stringlengths
0
402
repo_primary_language
stringclasses
108 values
developer_username
stringlengths
1
25
developer_name
stringlengths
0
30
developer_company
stringlengths
0
82
tooling/tailwind/eslint.config.js
JavaScript
// FIXME: This kinda stinks... /// <reference types="../../tooling/eslint/types.d.ts" /> import baseConfig from "@acme/eslint-config/base"; export default [...baseConfig];
ymc9/my-t3-turbo
0
TypeScript
ymc9
Yiming Cao
zenstackhq
tooling/tailwind/native.ts
TypeScript
import type { Config } from "tailwindcss"; import base from "./base"; export default { content: base.content, presets: [base], theme: {}, } satisfies Config;
ymc9/my-t3-turbo
0
TypeScript
ymc9
Yiming Cao
zenstackhq
tooling/tailwind/web.ts
TypeScript
import type { Config } from "tailwindcss"; import animate from "tailwindcss-animate"; import base from "./base"; export default { content: base.content, presets: [base], theme: { container: { center: true, padding: "2rem", screens: { "2xl": "1400px", }, }, extend: { ...
ymc9/my-t3-turbo
0
TypeScript
ymc9
Yiming Cao
zenstackhq
turbo/generators/config.ts
TypeScript
import { execSync } from "node:child_process"; import type { PlopTypes } from "@turbo/gen"; interface PackageJson { name: string; scripts: Record<string, string>; dependencies: Record<string, string>; devDependencies: Record<string, string>; } export default function generator(plop: PlopTypes.NodePlopAPI): vo...
ymc9/my-t3-turbo
0
TypeScript
ymc9
Yiming Cao
zenstackhq
scripts/ceval/eval.py
Python
# This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval import os import argparse import pandas as pd import torch import json from llama_evaluator import Llama_Evaluator import time choices = ["A", "B", "C", "D"] def main(args, evaluator,take): assert os.path.exists("subject_mapping.json"...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/ceval/evaluator.py
Python
# This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval import string class Evaluator: def __init__(self, choices, model_name, k=-1): self.choices = choices self.model_name = model_name self.k = k self.puncs = list(string.punctuation) def format_example(s...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/ceval/llama_evaluator.py
Python
# This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval import os import re from tqdm import tqdm import random import numpy as np import torch from transformers import LlamaForCausalLM, LlamaTokenizer from evaluator import Evaluator class Llama_Evaluator(Evaluator): def __init__(self, choi...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/crawl_prompt.py
Python
import openai import sys import random openai.api_key = "" # you must provide your OpenAI API key before crawling if not openai.api_key: raise ValueError("OpenAI API key not provided. Please set the 'openai.api_key' variable.") def return_random_prompt(): system_prompt = "你需要尽可能给出多样化的任务指令和对应的回答。我们将用于人工评估ChatGPT...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/inference/gradio_demo.py
Python
import torch from transformers import ( LlamaForCausalLM, LlamaTokenizer, StoppingCriteria, ) import gradio as gr import argparse import os from queue import Queue from threading import Thread import traceback import gc # Parse command-line arguments parser = argparse.ArgumentParser() parser.add_argument( ...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/inference/inference_hf.py
Python
import argparse import json, os parser = argparse.ArgumentParser() parser.add_argument('--base_model', default=None, type=str, required=True) parser.add_argument('--lora_model', default=None, type=str,help="If None, perform inference on the base model") parser.add_argument('--tokenizer_path',default=None,type=str) pars...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/inference/patches.py
Python
import torch from torch import nn from typing import Optional, Tuple, Union import transformers from transformers.models.llama.modeling_llama import apply_rotary_pos_emb, rotate_half import math try: from xformers import ops as xops except ImportError: xops = None print( "Xformers is not installed ...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/langchain/langchain_qa.py
Python
import argparse import os parser = argparse.ArgumentParser() parser.add_argument('--file_path',required=True,type=str) parser.add_argument('--embedding_path',required=True,type=str) parser.add_argument('--model_path',required=True,type=str) parser.add_argument('--gpus', default="0", type=str) parser.add_argument('--cha...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/langchain/langchain_sum.py
Python
import argparse import os parser = argparse.ArgumentParser() parser.add_argument('--file_path',required=True,type=str) parser.add_argument('--model_path',required=True,type=str) parser.add_argument('--gpus', default="0", type=str) parser.add_argument('--chain_type', default="refine", type=str) args = parser.parse_args(...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/merge_llama_with_chinese_lora.py
Python
""" Usage: python merge_llama_with_chinese_lora.py \ --base_model path/to/llama/model \ --lora_model path/to/first/lora/model [path/to/second/lora/model] \ --output_type [pth|huggingface] \ --output_dir path/to/output/dir """ import argparse import json import os import gc import torch import peft from...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/merge_llama_with_chinese_lora_low_mem.py
Python
""" Usage: python merge_llama_with_chinese_lora_low_mem.py \ --base_model path/to/llama/model \ --lora_model path/to/first/lora[,path/to/second/lora] \ --output_type [pth|huggingface] \ --output_dir path/to/output/dir """ import argparse import json import os import gc import torch import peft from tra...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/merge_tokenizer/merge_tokenizers.py
Python
import os os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"]="python" from transformers import LlamaTokenizer from sentencepiece import sentencepiece_model_pb2 as sp_pb2_model import sentencepiece as spm import argparse parser = argparse.ArgumentParser() parser.add_argument('--llama_tokenizer_dir', default=None, type...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/openai_server_demo/openai_api_protocol.py
Python
from typing import Optional, List, Dict, Any, Union import time import shortuuid from pydantic import BaseModel, Field class ChatCompletionRequest(BaseModel): model: str = "chinese-llama-alpaca" messages: Union[str, List[Dict[str, str]]] temperature: Optional[float] = 0.7 top_p: Optional[float] = 1.0...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/openai_server_demo/openai_api_server.py
Python
import argparse import os from fastapi import FastAPI import uvicorn parser = argparse.ArgumentParser() parser.add_argument('--base_model', default=None, type=str, required=True) parser.add_argument('--lora_model', default=None, type=str,help="If None, perform inference on the base model") parser.add_argument('--token...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/openai_server_demo/patches.py
Python
import torch from torch import nn from typing import Optional, Tuple, Union import transformers from transformers.models.llama.modeling_llama import apply_rotary_pos_emb, rotate_half import math try: from xformers import ops as xops except ImportError: xops = None print( "Xformers is not installed ...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/build_dataset.py
Python
import logging import os from dataclasses import dataclass from typing import Dict, Sequence, Union, List import datasets import torch from datasets import load_dataset, concatenate_datasets import transformers IGNORE_INDEX = -100 logger = logging.getLogger('__name__') PROMPT_TEMPLATE = ( "Below is an instr...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/run_clm_pt_with_peft.py
Python
#!/usr/bin/env python # coding=utf-8 # Copyright 2020 The HuggingFace Inc. 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/LI...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/run_clm_sft_with_peft.py
Python
#!/usr/bin/env python # coding=utf-8 # Copyright 2020 The HuggingFace Inc. 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/LI...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/run_pt.sh
Shell
lr=2e-4 lora_rank=8 lora_alpha=32 lora_trainable="q_proj,v_proj,k_proj,o_proj,gate_proj,down_proj,up_proj" modules_to_save="embed_tokens,lm_head" lora_dropout=0.05 pretrained_model=path/to/hf/llama/dir chinese_tokenizer_path=path/to/chinese/llama/tokenizer/dir dataset_dir=path/to/pt/data/dir data_cache=temp_data_cache...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/run_sft.sh
Shell
lr=1e-4 lora_rank=8 lora_alpha=32 lora_trainable="q_proj,v_proj,k_proj,o_proj,gate_proj,down_proj,up_proj" modules_to_save="embed_tokens,lm_head" lora_dropout=0.05 pretrained_model=path/to/hf/llama/or/merged/llama/dir/or/model_id chinese_tokenizer_path=path/to/chinese/llama/tokenizer/dir dataset_dir=path/to/sft/data/d...
ymcui/Chinese-LLaMA-Alpaca
18,964
中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/ceval/eval.py
Python
# This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval import os import argparse import pandas as pd import torch import json from llama_evaluator import Llama_Evaluator import time choices = ["A", "B", "C", "D"] def main(args, evaluator, take): assert os.path.exists("subject_mapping.js...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/ceval/llama_evaluator.py
Python
# This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval import os import re from tqdm import tqdm import random import numpy as np import torch from transformers import AutoModelForCausalLM, AutoTokenizer from transformers import GenerationConfig DEFAULT_SYSTEM_PROMPT = """You are a helpful as...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/cmmlu/categories.py
Python
# This code is modified from CMMLU Project: https://github.com/haonan-li/CMMLU name_en2zh = { "agronomy": "农学", "anatomy": "解剖学", "ancient_chinese": "古汉语", "arts": "艺术学", "astronomy": "天文学", "business_ethics": "商业伦理", "chinese_civil_service_exam": "中国公务员考试", "chinese_driving_rule": "中国驾驶...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/cmmlu/eval.py
Python
# This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval import os import argparse import pandas as pd import torch import json from llama_evaluator import Llama_Evaluator from glob import glob import time from collections import defaultdict from categories import name_en2zh, subcategories, catego...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/cmmlu/llama_evaluator.py
Python
# This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval import os import re from tqdm import tqdm import random import numpy as np import torch from transformers import AutoModelForCausalLM, AutoTokenizer from transformers import GenerationConfig DEFAULT_SYSTEM_PROMPT = """You are a helpful as...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/inference/inference_hf.py
Python
import argparse import json, os import torch from transformers import AutoModelForCausalLM, AutoTokenizer from transformers import GenerationConfig from transformers import BitsAndBytesConfig DEFAULT_SYSTEM_PROMPT = """You are a helpful assistant. 你是一个乐于助人的助手。""" system_format='<|start_header_id|>system<|end_header_i...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/llama_cpp/chat.sh
Shell
#!/bin/bash # script to chat with Llama-3-Chinese-Instruct model # usage: ./chat.sh llama-3-chinese-instruct-gguf-model-path your-first-instruction # WARNING: the hyperparameters are not optimal, please tune them yourself FIRST_INSTRUCTION=$2 SYSTEM_PROMPT="You are a helpful assistant. 你是一个乐于助人的助手。" ./main -m $1 --c...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/longbench/eval.py
Python
# The script is from https://github.com/THUDM/LongBench import os import json import argparse import numpy as np from metrics import ( qa_f1_score, rouge_zh_score, qa_f1_zh_score, rouge_score, classification_score, retrieval_score, retrieval_zh_score, count_score, code_sim_score, ) ...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/longbench/metrics.py
Python
# The script is from https://github.com/THUDM/LongBench import re import string import jieba from fuzzywuzzy import fuzz import difflib from collections import Counter from rouge import Rouge def normalize_answer(s): """Lower text and remove punctuation, articles and extra whitespace.""" def remove_articles...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/longbench/pred.py
Python
# The script is modified from https://github.com/THUDM/LongBench/blob/main/pred.py from datasets import load_dataset import torch import random import numpy as np import json from transformers import AutoTokenizer, AutoModelForCausalLM from transformers import BitsAndBytesConfig from tqdm import tqdm import os import a...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/merge_llama3_with_chinese_lora_low_mem.py
Python
""" Usage: python merge_llama3_with_chinese_lora_low_mem.py \ --base_model path/to/llama-3-hf-model \ --lora_model path/to/llama-3-chinese-lora \ --output_type [huggingface|pth|] \ --output_dir path/to/output-dir """ import argparse import json import os import gc import torch import peft from transfor...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/mmlu/categories.py
Python
subcategories = { "abstract_algebra": ["math"], "anatomy": ["health"], "astronomy": ["physics"], "business_ethics": ["business"], "clinical_knowledge": ["health"], "college_biology": ["biology"], "college_chemistry": ["chemistry"], "college_computer_science": ["computer science"], "c...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/mmlu/eval.py
Python
# modified from https://github.com/baichuan-inc/Baichuan-7B/blob/main/evaluation/evaluate_mmlu.py import argparse import os import torch import numpy as np import pandas as pd from categories import subcategories, categories from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig choices = ["A"...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/oai_api_demo/openai_api_protocol.py
Python
from typing import Optional, List, Dict, Any, Union, Literal import time import shortuuid from pydantic import BaseModel, Field class ChatCompletionRequest(BaseModel): model: str = "llama-3-chinese" messages: Union[str, List[Dict[str, str]]] temperature: Optional[float] = 0.2 top_p: Optional[float] ...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/oai_api_demo/openai_api_server.py
Python
import argparse import os from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware import uvicorn from threading import Thread from sse_starlette.sse import EventSourceResponse parser = argparse.ArgumentParser() parser.add_argument('--base_model', default=None, type=str, required=True) parser.add...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/build_dataset.py
Python
import logging import os from typing import Union, List import datasets import torch from datasets import load_dataset, concatenate_datasets import transformers IGNORE_INDEX = -100 logger = logging.getLogger('__name__') DEFAULT_SYSTEM_PROMPT = """You are a helpful assistant. 你是一个乐于助人的助手。""" system_format='<|start_h...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/run_clm_pt_with_peft.py
Python
#!/usr/bin/env python # coding=utf-8 # Copyright 2020 The HuggingFace Inc. 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/LI...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/run_clm_sft_with_peft.py
Python
#!/usr/bin/env python # coding=utf-8 # Copyright 2020 The HuggingFace Inc. 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/LI...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/run_pt.sh
Shell
#!/bin/bash ## 运行脚本前请仔细阅读wiki(https://github.com/ymcui/Chinese-LLaMA-Alpaca-3/wiki/pt_scripts_zh) ## Read the wiki(https://github.com/ymcui/Chinese-LLaMA-Alpaca-3/wiki/pt_scripts_en) carefully before running the script lr=1e-4 lora_rank=64 lora_alpha=128 lora_trainable="q_proj,v_proj,k_proj,o_proj,gate_proj,down_proj,u...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/run_sft.sh
Shell
#!/bin/bash ## 运行脚本前请仔细阅读wiki(https://github.com/ymcui/Chinese-LLaMA-Alpaca-3/wiki/sft_scripts_zh) ## Read the wiki(https://github.com/ymcui/Chinese-LLaMA-Alpaca-3/wiki/sft_scripts_en) carefully before running the script lr=1e-4 lora_rank=64 lora_alpha=128 lora_trainable="q_proj,v_proj,k_proj,o_proj,gate_proj,down_proj...
ymcui/Chinese-LLaMA-Alpaca-3
1,964
中文羊驼大模型三期项目 (Chinese Llama-3 LLMs) developed from Meta Llama 3
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/ceval/eval.py
Python
# This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval import os import argparse import pandas as pd import torch import json from mixtral_evaluator import Mixtral_Evaluator import time choices = ["A", "B", "C", "D"] def main(args, evaluator,take): assert os.path.exists("subject_mapping.j...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/ceval/evaluator.py
Python
# This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval import string class Evaluator: def __init__(self, choices, model_name, k=-1): self.choices = choices self.model_name = model_name self.k = k self.puncs = list(string.punctuation) def format_example(s...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/ceval/mixtral_evaluator.py
Python
# This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval import os import re from tqdm import tqdm import random import numpy as np import torch from transformers import AutoModelForCausalLM, LlamaTokenizer, BitsAndBytesConfig from transformers import GenerationConfig from evaluator import Evalua...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/cmmlu/categories.py
Python
# This code is modified from CMMLU Project: https://github.com/haonan-li/CMMLU name_en2zh = { "agronomy": "农学", "anatomy": "解剖学", "ancient_chinese": "古汉语", "arts": "艺术学", "astronomy": "天文学", "business_ethics": "商业伦理", "chinese_civil_service_exam": "中国公务员考试", "chinese_driving_rule": "中国驾驶...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/cmmlu/eval.py
Python
# This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval import os import argparse import pandas as pd import torch import json from mxitral_evaluator import Mixtral_Evaluator from glob import glob import time from collections import defaultdict from categories import name_en2zh, subcategories, ca...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/cmmlu/evaluator.py
Python
# This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval import string class Evaluator: def __init__(self, choices, model_path, k=-1): self.choices = choices self.model_path = model_path self.k = k self.puncs = list(string.punctuation) def format_example(se...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/cmmlu/mixtral_evaluator.py
Python
# This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval import os import re from tqdm import tqdm import random import numpy as np import torch from transformers import AutoModelForCausalLM, LlamaTokenizer, BitsAndBytesConfig from transformers import GenerationConfig from evaluator import Evalua...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/inference/inference_hf.py
Python
import argparse import json, os TEMPLATE = ( "[INST] {instruction} [/INST]" ) parser = argparse.ArgumentParser() parser.add_argument('--base_model', default=None, type=str, required=True) parser.add_argument('--tokenizer_path', default=None, type=str) parser.add_argument('--data_file', default=None, type=str, hel...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/llamacpp/chat.sh
Shell
#!/bin/bash # script to chat with Chinese-Mixtral-Instruct model # usage: ./chat.sh chinese-mixtral-instruct-gguf-model-path # WARNING: the hyperparameters are not optimal, please tune them yourself ./main -m $1 --color --interactive-first \ -c 4096 -t 6 --temp 0.2 --repeat_penalty 1.1 -ngl 999 \ --in-prefix ' [INST]...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/longbench/eval.py
Python
# The script is from https://github.com/THUDM/LongBench import os import json import argparse import numpy as np from metrics import ( qa_f1_score, rouge_zh_score, qa_f1_zh_score, rouge_score, classification_score, retrieval_score, retrieval_zh_score, count_score, code_sim_score, ) ...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/longbench/metrics.py
Python
# The script is from https://github.com/THUDM/LongBench import re import string import jieba from fuzzywuzzy import fuzz import difflib from collections import Counter from rouge import Rouge def normalize_answer(s): """Lower text and remove punctuation, articles and extra whitespace.""" def remove_articles...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/longbench/pred_mixtral.py
Python
# The script is modified from https://github.com/THUDM/LongBench/blob/main/pred.py from datasets import load_dataset import torch import random import numpy as np import json from transformers import LlamaTokenizer, AutoModelForCausalLM from transformers import BitsAndBytesConfig from tqdm import tqdm import os import ...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/merge_mixtral_with_chinese_lora_low_mem.py
Python
""" Usage: python merge_mixtral_with_chinese_lora_low_mem.py \ --base_model path/to/Mixtral-8x7B-v0.1 \ --lora_model path/to/chinese-Mixtral-8x7B-v0.1-lora \ --output_dir path/to/output-dir """ import argparse import json import os import gc import torch import peft from transformers import LlamaTokenizer ...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/mmlu/categories.py
Python
subcategories = { "abstract_algebra": ["math"], "anatomy": ["health"], "astronomy": ["physics"], "business_ethics": ["business"], "clinical_knowledge": ["health"], "college_biology": ["biology"], "college_chemistry": ["chemistry"], "college_computer_science": ["computer science"], "c...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/mmlu/eval.py
Python
# modified from https://github.com/baichuan-inc/Baichuan-7B/blob/main/evaluation/evaluate_mmlu.py import argparse import os import torch import numpy as np import pandas as pd from categories import subcategories, categories from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig choices = ["A"...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/openai_server_demo/openai_api_protocol.py
Python
from typing import Optional, List, Dict, Any, Union, Literal import time import shortuuid from pydantic import BaseModel, Field class ChatCompletionRequest(BaseModel): model: str = "chinese-mixtral" messages: Union[str, List[Dict[str, str]]] temperature: Optional[float] = 0.2 top_p: Optional[float] ...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/openai_server_demo/openai_api_server.py
Python
import argparse import os from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware import uvicorn from threading import Thread from sse_starlette.sse import EventSourceResponse parser = argparse.ArgumentParser() parser.add_argument('--base_model', default=None, type=str, required=True) parser.add...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/build_dataset.py
Python
import logging import os from typing import Union, List import datasets import torch from datasets import load_dataset, concatenate_datasets import transformers IGNORE_INDEX = -100 logger = logging.getLogger('__name__') PROMPT_TEMPLATE = ( "[INST] {instruction} [/INST]" ) def build_instruction_dataset(...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/run_clm_pt_with_peft.py
Python
#!/usr/bin/env python # coding=utf-8 # Copyright 2020 The HuggingFace Inc. 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/LI...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/run_clm_sft_with_peft.py
Python
#!/usr/bin/env python # coding=utf-8 # Copyright 2020 The HuggingFace Inc. 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/LI...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/run_pt.sh
Shell
## 运行脚本前请仔细阅读wiki(https://github.com/ymcui/Chinese-Mixtral/wiki/pt_scripts_zh) ## Read the wiki(https://github.com/ymcui/Chinese-Mixtral/wiki/pt_scripts_en) carefully before running the script lr=1e-4 lora_rank=64 lora_alpha=128 lora_trainable="q_proj,v_proj,k_proj,o_proj,gate,w1,w2,w3" modules_to_save="embed_tokens,l...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
scripts/training/run_sft.sh
Shell
## 运行脚本前请仔细阅读wiki(https://github.com/ymcui/Chinese-Mixtral/wiki/sft_scripts_zh) ## Read the wiki(https://github.com/ymcui/Chinese-Mixtral/wiki/sft_scripts_en) carefully before running the script lr=1e-4 lora_rank=64 lora_alpha=128 lora_trainable="q_proj,v_proj,k_proj,o_proj,gate,w1,w2,w3" modules_to_save="embed_tokens...
ymcui/Chinese-Mixtral
609
中文Mixtral混合专家大模型(Chinese Mixtral MoE LLMs)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/classifier_utils.py
Python
from absl import flags import re import numpy as np import tensorflow as tf from data_utils import SEP_ID, CLS_ID FLAGS = flags.FLAGS SEG_ID_A = 0 SEG_ID_B = 1 SEG_ID_CLS = 2 SEG_ID_SEP = 3 SEG_ID_PAD = 4 class PaddingInputExample(object): """Fake example so the num input examples is a multiple of the batch ...
ymcui/Chinese-XLNet
1,650
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/cmrc2018_evaluate_drcd.py
Python
# -*- coding: utf-8 -*- ''' Evaluation script for CMRC 2018 version: v5 Note: v5 formatted output, add usage description v4 fixed segmentation issues ''' from __future__ import print_function from collections import Counter, OrderedDict import string import re import argparse import json import sys reload(sys) sys.set...
ymcui/Chinese-XLNet
1,650
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/data_utils.py
Python
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import json import os import random from absl import flags import absl.logging as _logging # pylint: disable=unused-import import numpy as np import tensorflow as tf from prepro_u...
ymcui/Chinese-XLNet
1,650
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/function_builder.py
Python
"""doc.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import functools import os import tensorflow as tf import modeling import xlnet def construct_scalar_host_call( monitor_dict, model_dir, prefix="", reduce_fn=None): """ Construc...
ymcui/Chinese-XLNet
1,650
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/gpu_utils.py
Python
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import tensorflow as tf def assign_to_gpu(gpu=0, ps_dev="/device:CPU:0"): def _assign(op): node_def = op if isinstance(op, tf.NodeDef) else op.node_def if node_def.op == "Variable...
ymcui/Chinese-XLNet
1,650
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/model_utils.py
Python
from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import os import re import numpy as np import six from os.path import join from six.moves import zip from absl import flags import tensorflow as tf def configure_tpu(FLAGS): if FLAGS.us...
ymcui/Chinese-XLNet
1,650
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/modeling.py
Python
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf def gelu(x): """Gaussian Error Linear Unit. This is a smoother version of the RELU. Original paper: https://arxiv.org/abs/1606.08415 Args: x: float Tens...
ymcui/Chinese-XLNet
1,650
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/prepro_utils.py
Python
# coding=utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function import unicodedata import six from functools import partial SPIECE_UNDERLINE = '▁' def printable_text(text): """Returns text encoded in a way suitable for print or `tf.logging`.""" # The...
ymcui/Chinese-XLNet
1,650
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/run_classifier.py
Python
from __future__ import absolute_import from __future__ import division from __future__ import print_function from os.path import join from absl import flags import os import sys import csv import collections import numpy as np import time import math import json import random from copy import copy from collections imp...
ymcui/Chinese-XLNet
1,650
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/run_cmrc_drcd.py
Python
# coding=utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function from absl import flags import absl.logging as _logging # pylint: disable=unused-import import collections import os import time import math import json import six import random import gc impor...
ymcui/Chinese-XLNet
1,650
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/squad_utils.py
Python
"""Official evaluation script for SQuAD version 2.0. In addition to basic functionality, we also compute additional statistics and plot precision-recall curves if an additional na_prob.json file is provided. This file is expected to map question ID's to the model's predicted probability that a question is unanswerable...
ymcui/Chinese-XLNet
1,650
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/summary.py
Python
# -*- coding: utf-8 -*- ''' print summary ''' from __future__ import print_function from collections import Counter, OrderedDict import string import re import argparse import json import sys reload(sys) sys.setdefaultencoding('utf-8') import pdb import os import math import numpy as np import collections from prettyta...
ymcui/Chinese-XLNet
1,650
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/tpu_estimator.py
Python
# Copyright 2017 The TensorFlow 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 required by applica...
ymcui/Chinese-XLNet
1,650
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/xlnet.py
Python
from __future__ import absolute_import from __future__ import division from __future__ import print_function import json import os import tensorflow as tf import modeling def _get_initializer(FLAGS): """Get variable intializer.""" if FLAGS.init == "uniform": initializer = tf.initializers.random_uniform( ...
ymcui/Chinese-XLNet
1,650
Pre-Trained Chinese XLNet(中文XLNet预训练模型)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/modeling.py
Python
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 required by ...
ymcui/LERT
221
LERT: A Linguistically-motivated Pre-trained Language Model(语言学信息增强的预训练模型LERT)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/optimization.py
Python
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 required by ...
ymcui/LERT
221
LERT: A Linguistically-motivated Pre-trained Language Model(语言学信息增强的预训练模型LERT)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/run.pretrain.sh
Shell
#!/bin/bash set -ex TPU_NAME="your-tpu-name" TPU_ZONE="your-tpu-zone" DATA_DIR=./your-path-to-tfrecords MODEL_DIR=./your-path-to-model-saving CONFIG_FILE=./your-path-to-config-file # run pretraining python run_pretraining.py \ --input_file=${DATA_DIR}/tf_examples.tfrecord.* \ --output_dir=${MODEL_DIR} \ --do_train...
ymcui/LERT
221
LERT: A Linguistically-motivated Pre-trained Language Model(语言学信息增强的预训练模型LERT)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/run_pretraining.py
Python
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 required by ...
ymcui/LERT
221
LERT: A Linguistically-motivated Pre-trained Language Model(语言学信息增强的预训练模型LERT)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
src/tokenization.py
Python
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 required by ...
ymcui/LERT
221
LERT: A Linguistically-motivated Pre-trained Language Model(语言学信息增强的预训练模型LERT)
Python
ymcui
Yiming Cui
Joint Laboratory of HIT and iFLYTEK Research (HFL)
gatsby-config.js
JavaScript
require('dotenv').config() module.exports = { plugins: [ `gatsby-plugin-sharp`, { resolve: `gatsby-source-graphcms`, options: { downloadLocalImages: true, endpoint: process.env.GRAPHCMS_ENDPOINT, token: process.env.GRAPHCMS_TOKEN, }, }, `gatsby-transformer-sh...
ynnoj/2020-07-17-gatsby-preview-graphcms
1
📹 Preview GraphCMS content with Gatsby Cloud
JavaScript
ynnoj
Jonathan Steele
stripe
src/pages/index.js
JavaScript
import React from 'react' import { graphql } from 'gatsby' import Img from 'gatsby-image' function IndexPage({ data }) { const { products } = data return products.nodes.map((product) => ( <React.Fragment> <h1 key={product.id}>{product.name}</h1> {product.images.map((image) => ( <Img ...
ynnoj/2020-07-17-gatsby-preview-graphcms
1
📹 Preview GraphCMS content with Gatsby Cloud
JavaScript
ynnoj
Jonathan Steele
stripe
gatsby-browser.js
JavaScript
import React from 'react' import { MDXProvider } from '@mdx-js/react' const wrapRootElement = ({ element }) => { return ( <MDXProvider components={{ h2: (props) => <h2 style={{ color: 'blue' }} {...props} />, p: (props) => <p style={{ color: 'red' }} {...props} />, CTA: (props) => (...
ynnoj/2020-08-07-working-with-mdx-graphcms
2
📹 Working with MDX and GraphCMS
JavaScript
ynnoj
Jonathan Steele
stripe
gatsby-config.js
JavaScript
require('dotenv').config() module.exports = { plugins: [ 'gatsby-plugin-mdx', { resolve: 'gatsby-source-graphcms', options: { endpoint: process.env.GRAPHCMS_ENDPOINT, token: process.env.GRAPHCMS_TOKEN, buildMarkdownNodes: true, }, }, ], }
ynnoj/2020-08-07-working-with-mdx-graphcms
2
📹 Working with MDX and GraphCMS
JavaScript
ynnoj
Jonathan Steele
stripe
src/pages/index.js
JavaScript
import React from 'react' import { graphql } from 'gatsby' import { MDXRenderer } from 'gatsby-plugin-mdx' function IndexPage({ data }) { const { posts } = data return posts.nodes.map((post) => ( <div key={post.id}> <h1>{post.title}</h1> <MDXRenderer>{post.content.markdownNode.childMdx.body}</MDXR...
ynnoj/2020-08-07-working-with-mdx-graphcms
2
📹 Working with MDX and GraphCMS
JavaScript
ynnoj
Jonathan Steele
stripe
gatsby-browser.js
JavaScript
import React from 'react' import { ApolloClient, ApolloProvider, HttpLink, InMemoryCache, } from '@apollo/client' import { MDXProvider } from '@mdx-js/react' import fetch from 'isomorphic-fetch' import './src/styles/index.css' import Layout from './src/components/layout' const httpLink = new HttpLink({ uri:...
ynnoj/2020-08-28-dynamic-content-in-gatsby
2
📹 Dynamic content in Gatsby with Apollo Client
JavaScript
ynnoj
Jonathan Steele
stripe
gatsby-config.js
JavaScript
require('dotenv').config() module.exports = { siteMetadata: { title: 'GraphCMS Blog', description: 'Gatsby blog starter for GraphCMS! Powered by `gatsby-source-graphcms`, featuring `gatsby-image` and MDX!', keywords: 'Headless CMS, GraphCMS, GraphQL CMS, Gatsby', }, plugins: [ 'gatsby-plugi...
ynnoj/2020-08-28-dynamic-content-in-gatsby
2
📹 Dynamic content in Gatsby with Apollo Client
JavaScript
ynnoj
Jonathan Steele
stripe
gatsby-node.js
JavaScript
const path = require('path') exports.createPages = async ({ actions: { createPage }, graphql }) => { const { data } = await graphql( ` { pages: allGraphCmsPage { nodes { id content { markdownNode { childMdx { body ...
ynnoj/2020-08-28-dynamic-content-in-gatsby
2
📹 Dynamic content in Gatsby with Apollo Client
JavaScript
ynnoj
Jonathan Steele
stripe
gatsby-ssr.js
JavaScript
export { wrapPageElement, wrapRootElement } from './gatsby-browser'
ynnoj/2020-08-28-dynamic-content-in-gatsby
2
📹 Dynamic content in Gatsby with Apollo Client
JavaScript
ynnoj
Jonathan Steele
stripe
postcss.config.js
JavaScript
module.exports = { plugins: [require('postcss-preset-env'), require('tailwindcss')], }
ynnoj/2020-08-28-dynamic-content-in-gatsby
2
📹 Dynamic content in Gatsby with Apollo Client
JavaScript
ynnoj
Jonathan Steele
stripe
src/components/footer.js
JavaScript
import React from 'react' import GitHubSVG from '../svg/github.svg' import LinkedInSVG from '../svg/linkedin.svg' import SlackSVG from '../svg/slack.svg' import TwitterSVG from '../svg/twitter.svg' const socialLinks = [ { Component: GitHubSVG, href: 'https://github.com/graphcms/gatsby-graphcms-ecommerce-sta...
ynnoj/2020-08-28-dynamic-content-in-gatsby
2
📹 Dynamic content in Gatsby with Apollo Client
JavaScript
ynnoj
Jonathan Steele
stripe
src/components/header.js
JavaScript
import React, { useEffect, useState } from 'react' import { graphql, Link, useStaticQuery } from 'gatsby' import { globalHistory, useLocation } from '@reach/router' import cx from 'classnames' import GraphCMSLogo from '../svg/logo.svg' import GraphCMSMark from '../svg/mark.svg' import Transition from './transition' f...
ynnoj/2020-08-28-dynamic-content-in-gatsby
2
📹 Dynamic content in Gatsby with Apollo Client
JavaScript
ynnoj
Jonathan Steele
stripe
src/components/layout.js
JavaScript
import React from 'react' import Footer from './footer' import Header from './header' import SEO from './seo' function Layout({ children, pageContext: { page } }) { return ( <React.Fragment> <SEO {...page} /> <div className="flex flex-col min-h-screen"> <div className="flex-grow max-w-3xl mx...
ynnoj/2020-08-28-dynamic-content-in-gatsby
2
📹 Dynamic content in Gatsby with Apollo Client
JavaScript
ynnoj
Jonathan Steele
stripe
src/components/seo.js
JavaScript
import React from 'react' import { graphql, useStaticQuery } from 'gatsby' import { Helmet } from 'react-helmet' function SEO({ title, seo }) { const { site: { siteMetadata }, } = useStaticQuery(graphql` { site { siteMetadata { description keywords title ...
ynnoj/2020-08-28-dynamic-content-in-gatsby
2
📹 Dynamic content in Gatsby with Apollo Client
JavaScript
ynnoj
Jonathan Steele
stripe
src/components/transition.js
JavaScript
import React, { useRef, useEffect, useContext } from 'react' import { CSSTransition as ReactCSSTransition } from 'react-transition-group' const TransitionContext = React.createContext({ parent: {}, }) function useIsInitialRender() { const isInitialRender = useRef(true) useEffect(() => { isInitialRender.curr...
ynnoj/2020-08-28-dynamic-content-in-gatsby
2
📹 Dynamic content in Gatsby with Apollo Client
JavaScript
ynnoj
Jonathan Steele
stripe