Skip to content

BLEU calculation occurs only on the CPU #12

Description

@LynxPDA

BLEU calculation occurs only on the CPU, perhaps this is somehow related to the function below

eval.py#L56C44-L56C44

def translator():
    device = "cuda" if ctranslate2.get_cuda_device_count() > 0 else "cpu"
    model = ctranslate2.Translator(ct2_model_dir, device="cpu", compute_type="default")
    if os.path.isfile(sp_model):
        tokenizer = SentencePieceTokenizer(sp_model)
    elif os.path.isfile(bpe_model):
        tokenizer = BPETokenizer(bpe_model, config["from"]["code"], config["to"]["code"])
    return {"model": model, "tokenizer": tokenizer}

I tried replacing device="cpu" with device=device , in which case the GPU was used, but I was getting an OOM error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions