Unverified Commit 563fb0aa authored by Dynamic's avatar Dynamic Committed by GitHub
Browse files

Merge branch 'AUTOMATIC1111:master' into kr-localization

parents e595b41c 3e15f8e0
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -108,6 +108,9 @@ function processNode(node){

function dumpTranslations(){
    dumped = {}
    if (localization.rtl) {
        dumped.rtl = true
    }

    Object.keys(original_lines).forEach(function(text){
        if(dumped[text] !== undefined)  return
@@ -129,6 +132,24 @@ onUiUpdate(function(m){

document.addEventListener("DOMContentLoaded", function() {
    processNode(gradioApp())

    if (localization.rtl) {  // if the language is from right to left,
        (new MutationObserver((mutations, observer) => { // wait for the style to load
            mutations.forEach(mutation => {
                mutation.addedNodes.forEach(node => {
                    if (node.tagName === 'STYLE') {
                        observer.disconnect();

                        for (const x of node.sheet.rules) {  // find all rtl media rules
                            if (Array.from(x.media || []).includes('rtl')) {
                                x.media.appendMedium('all');  // enable them
                            }
                        }
                    }
                })
            });
        })).observe(gradioApp(), { childList: true });
    }
})

function download_localization() {
+455 −690

File changed.

Preview size limit exceeded, changes collapsed.

+418 −0

File added.

Preview size limit exceeded, changes collapsed.

+5 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ def enable_tf32():

errors.run(enable_tf32, "Enabling TF32")

device = device_interrogate = device_gfpgan = device_bsrgan = device_esrgan = device_scunet = device_codeformer = None
device = device_interrogate = device_gfpgan = device_swinir = device_esrgan = device_scunet = device_codeformer = None
dtype = torch.float16
dtype_vae = torch.float16

@@ -81,3 +81,7 @@ def autocast(disable=False):
        return contextlib.nullcontext()

    return torch.autocast("cuda")

# MPS workaround for https://github.com/pytorch/pytorch/issues/79383
def mps_contiguous(input_tensor, device): return input_tensor.contiguous() if device.type == 'mps' else input_tensor
def mps_contiguous_to(input_tensor, device): return mps_contiguous(input_tensor, device).to(device)
+1 −1
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ def upscale_without_tiling(model, img):
    img = img[:, :, ::-1]
    img = np.ascontiguousarray(np.transpose(img, (2, 0, 1))) / 255
    img = torch.from_numpy(img).float()
    img = img.unsqueeze(0).to(devices.device_esrgan)
    img = devices.mps_contiguous_to(img.unsqueeze(0), devices.device_esrgan)
    with torch.no_grad():
        output = model(img)
    output = output.squeeze().float().cpu().clamp_(0, 1).numpy()
Loading