Merge pull request #37 from VE-FORBRYDERNE/patch

Use model.config.n_layer if model.config.num_layers doesn't exist
This commit is contained in:
henk717 2021-11-23 17:02:51 +01:00 committed by GitHub
commit 11c64c3fe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -212,7 +212,7 @@ def device_list(n_layers, primary=None, selected=None):
def device_config(model):
global breakmodel, generator
import breakmodel
n_layers = model.config.num_layers
n_layers = model.config.num_layers or model.config.n_layer
if(args.breakmodel_gpulayers is not None):
try:
breakmodel.gpu_blocks = list(map(int, args.breakmodel_gpulayers.split(',')))
@ -278,7 +278,7 @@ def device_config(model):
# If all layers are on the same device, use the old GPU generation mode
while(len(breakmodel.gpu_blocks) and breakmodel.gpu_blocks[-1] == 0):
breakmodel.gpu_blocks.pop()
if(len(breakmodel.gpu_blocks) and breakmodel.gpu_blocks[-1] in (-1, model.config.num_layers)):
if(len(breakmodel.gpu_blocks) and breakmodel.gpu_blocks[-1] in (-1, model.config.num_layers or model.config.n_layer)):
vars.breakmodel = False
vars.usegpu = True
model = model.half().to(len(breakmodel.gpu_blocks)-1)