Hidden Size fix for GPT2 Custom
Replaced the JS Hidden Size load with the newer function to fix these models
This commit is contained in:
parent
f227a876c0
commit
3e38b462c6
|
@ -627,9 +627,9 @@ if(not vars.model in ["InferKit", "Colab", "OAI", "ReadOnly"]):
|
||||||
elif(vars.model == "GPT2Custom"):
|
elif(vars.model == "GPT2Custom"):
|
||||||
model_config = open(vars.custmodpth + "/config.json", "r")
|
model_config = open(vars.custmodpth + "/config.json", "r")
|
||||||
js = json.load(model_config)
|
js = json.load(model_config)
|
||||||
vars.modeldim = int(js['hidden_size'])
|
|
||||||
model = GPT2LMHeadModel.from_pretrained(vars.custmodpth)
|
model = GPT2LMHeadModel.from_pretrained(vars.custmodpth)
|
||||||
tokenizer = GPT2Tokenizer.from_pretrained(vars.custmodpth)
|
tokenizer = GPT2Tokenizer.from_pretrained(vars.custmodpth)
|
||||||
|
vars.modeldim = get_hidden_size_from_model(model)
|
||||||
# Is CUDA available? If so, use GPU, otherwise fall back to CPU
|
# Is CUDA available? If so, use GPU, otherwise fall back to CPU
|
||||||
if(vars.hascuda and vars.usegpu):
|
if(vars.hascuda and vars.usegpu):
|
||||||
model = model.to(0)
|
model = model.to(0)
|
||||||
|
|
Loading…
Reference in New Issue