forked from hyunwoongko/openchat
-
Notifications
You must be signed in to change notification settings - Fork 3
/
model_download.py
41 lines (34 loc) · 1.65 KB
/
model_download.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from transformers import (
BlenderbotSmallForConditionalGeneration,
BlenderbotSmallTokenizer,
BlenderbotForConditionalGeneration,
BlenderbotTokenizer,
)
from transformers import GPT2LMHeadModel, GPT2Tokenizer
from transformers import AutoTokenizer, AutoModelForCausalLM
import sys
download_type = sys.argv[1]
if download_type == 'dialogpt':
#------dialogpt samll------#
model = GPT2LMHeadModel.from_pretrained("microsoft/DialoGPT-small")
tokenizer = GPT2Tokenizer.from_pretrained("microsoft/DialoGPT-small")
#------dialogpt medium------#
model = GPT2LMHeadModel.from_pretrained("microsoft/DialoGPT-medium")
tokenizer = GPT2Tokenizer.from_pretrained("microsoft/DialoGPT-medium")
print("dialogpt is done!")
elif download_type == 'gptneo':
#------gptneo small------#
model = AutoModelForCausalLM.from_pretrained("EleutherAI/gpt-neo-125M")
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neo-125M")
#------gptneo large------#
#model = AutoModelForCausalLM.from_pretrained("EleutherAI/gpt-neo-1.3B")
#tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B")
print("gptneo is done!")
elif download_type == 'blender':
#------blender small------#
model = BlenderbotSmallForConditionalGeneration.from_pretrained("facebook/blenderbot_small-90M")
tokenizer = BlenderbotSmallTokenizer.from_pretrained("facebook/blenderbot_small-90M")
#------blender medium------#
model = BlenderbotForConditionalGeneration.from_pretrained("facebook/blenderbot-400M-distill")
tokenizer = BlenderbotTokenizer.from_pretrained("facebook/blenderbot-400M-distill")
print("blender is done!")