|
9 | 9 | #-- |
10 | 10 | #-- Implementation Notes (Leave empty if nothing to say): |
11 | 11 | #-- - This is the config file used by the server. |
| 12 | +#-- - The settings here have priority over the client's settings. |
| 13 | +#-- Setting them to None will give the priority to the client. |
12 | 14 | #-- |
13 | 15 | #-- Anticipated changes (Leave empty if nothing to say): |
14 | 16 | #-- - |
|
29 | 31 | #-- |
30 | 32 | #-- 09/11/2022 Lyaaaaa |
31 | 33 | #-- - Set LOG_LEVEL default value back to INFO |
| 34 | +#-- |
| 35 | +#-- 04/05/2022 Lyaaaaa |
| 36 | +#-- - Added a new section "Models". This section contains settings for the |
| 37 | +#-- Model class. |
| 38 | +#-- |
| 39 | +#-- 05/05/2022 Lyaaaaa |
| 40 | +#-- - Import torch_dtype to support the usage of an enum for the dtypes. |
| 41 | +#-- - Added OFFLOAD_DICT to the settings. When True, it avoids RAM peak when |
| 42 | +#-- loading a model. |
| 43 | +#-- |
| 44 | +#-- 18/09/2023 Lyaaaaa |
| 45 | +#-- - LOG_FILEMODE default value is now "a" again. The log file is now |
| 46 | +#-- manually deleted to avoid losing logs. |
32 | 47 | #--------------------------------------------------------------------------- |
33 | 48 |
|
34 | 49 | import logging |
| 50 | +from torch_dtype import Torch_Dtypes |
35 | 51 |
|
36 | 52 | # Network |
37 | 53 | HOST = "0.0.0.0" |
38 | 54 | PORT = 9999 |
39 | 55 |
|
40 | 56 | # Logs |
41 | 57 | LOG_FILENAME = "server_logs.text" |
42 | | -LOG_FILEMODE = "w" |
| 58 | +LOG_FILEMODE = "a" |
43 | 59 | LOG_LEVEL = logging.INFO |
| 60 | + |
| 61 | +# Models. |
| 62 | +#See possible values here: https://huggingface.co/docs/transformers/main_classes/model#transformers.PreTrainedModel.from_pretrained |
| 63 | + |
| 64 | +TOKENIZERS_PATH = "models/" |
| 65 | +MODELS_PATH = "models/" |
| 66 | +DEFAULT_MODEL = "EleutherAI/gpt-neo-125M" |
| 67 | +ALLOW_DOWNLOAD = None # True/False/None. If True, the server will download AI's files. |
| 68 | +ALLOW_OFFLOAD = None # True/False/None |
| 69 | +OFFLOAD_FOLDER = "offload-" # Prefix to the temp folder. |
| 70 | +LOW_CPU_MEM_USAGE = None # True/False/None |
| 71 | +LIMIT_MEMORY = None # True/False/None |
| 72 | +OFFLOAD_DICT = None # True/False/None |
| 73 | + |
| 74 | +# https://huggingface.co/docs/accelerate/main/en/usage_guides/big_modeling#designing-a-device-map |
| 75 | +# MAX_MEMORY must be a dict. E.G {0: "30GB", 1: "46GB", [x: "yMB/yGB"], "cpu": "20000MB"}. x is a gpu. |
| 76 | +MAX_MEMORY = None # None/dict/See documentation |
| 77 | +DEVICE_MAP = None # None/see documentation |
| 78 | +TORCH_DTYPE = None # "Auto"/None/torch.dtype/See torch_dtype.py for more info. |
| 79 | + |
0 commit comments