fastchat.utils

Module Contents

Classes

StreamToLogger

Fake file-like stream object that redirects writes to a logger instance.

Functions

disable_torch_init()

Disable the redundant torch default initialization to accelerate model creation.

violates_moderation(text)

Check whether the text violates OpenAI moderation API.

class fastchat.utils.StreamToLogger(logger, log_level=logging.INFO)[source]

Fake file-like stream object that redirects writes to a logger instance.

fastchat.utils.disable_torch_init()[source]

Disable the redundant torch default initialization to accelerate model creation.

fastchat.utils.violates_moderation(text)[source]

Check whether the text violates OpenAI moderation API.