reformat black

pull/579/head
mike dupont 1 month ago
parent 3365e2efbf
commit 1644e89385

@ -20,7 +20,7 @@ from petals.utils.logging import initialize_logs as _initialize_logs
__version__ = "2.3.0.dev2"
#if not os.getenv("PETALS_IGNORE_DEPENDENCY_VERSION"):
# if not os.getenv("PETALS_IGNORE_DEPENDENCY_VERSION"):
# assert (
# version.parse("4.38.2") <= version.parse(transformers.__version__) < version.parse("4.39.0")
# ), "Please install a proper transformers version: pip install transformers>=4.37.1,<4.39.0"

@ -51,7 +51,7 @@ class PTuneMixin:
batch_size,
self.pre_seq_len,
self.config.num_hidden_layers,
self.config.hidden_size
self.config.hidden_size,
# TODO: should be num_hidden_layers - 1
)
intermediate_prompts = intermediate_prompts.permute([2, 0, 1, 3])

@ -1,6 +1,7 @@
"""
Utility functions that call RPC forward or backward on a single remote server
"""
import asyncio
from typing import Iterable, List, Optional, Sequence, Tuple

@ -3,6 +3,7 @@ An interface for exchanging internal "BLOOM points" for higher priority compute
The intent is to let Petals participants earn points by helping others while idle (e.g. at night), then use these
points to run their own compute experiments faster. See Section 4 of https://arxiv.org/abs/2209.01188 for discussion.
"""
from abc import ABC, abstractmethod

@ -1,6 +1,7 @@
"""
A PyTorch autograd function that runs forward/backward on a sequence of remote servers in a fault-tolerant manner
"""
import asyncio
import itertools
from collections import deque

@ -3,6 +3,7 @@ Bloom intermediate layer
Based on https://github.com/huggingface/transformers/commit/ca2a55e9dfb245527b5e1c954fec6ffbb7aef07b
See commit history for authorship.
"""
from typing import Optional, Tuple
import torch

@ -3,6 +3,7 @@ Falcon intermediate layer
Based on https://github.com/huggingface/transformers/blob/main/src/transformers/models/falcon/modeling_falcon.py
See commit history for authorship.
"""
import math
from functools import partial
from typing import Optional, Tuple

@ -3,6 +3,7 @@ LLaMA intermediate layer
Based on https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/modeling_llama.py
See commit history for authorship.
"""
import math
from typing import Optional, Tuple

@ -1,6 +1,7 @@
"""
This module implements server-side computations on served blocks: forward, backward and inference; used by handler
"""
from __future__ import annotations
from typing import Any, AsyncIterator, Dict, Optional, Sequence, Tuple, Union

@ -6,6 +6,7 @@ If necessary, one can rewrite this to implement a different behavior, such as:
- fetch the weights over IPoAC, using a fleet of trained pigeons ( http://www.faqs.org/rfcs/rfc1149.html )
"""
import json
import time
from contextlib import suppress

@ -4,6 +4,7 @@ A pytorch memory cache that can be allocated by ConnectionHandler (on cpu) and u
For now, the only purpose of this code is to ensure that allocated memory will be deleted properly.
"""
import asyncio
import contextlib
import ctypes

@ -41,7 +41,7 @@ class _AutoDistributedBase:
kwargs["use_auth_token"] = True
kwargs["trust_remote_code"] = True
#trust_remote_code=True
# trust_remote_code=True
config = AutoConfig.from_pretrained(model_name_or_path, *args, **kwargs)
if config.model_type not in _CLASS_MAPPING:

@ -1,6 +1,7 @@
"""
Tools for converting transformer blocks, applying quantization and/or tensor parallelism
"""
import re
from enum import Enum
from typing import Optional, Sequence

@ -1,6 +1,7 @@
"""
Utilities for declaring and retrieving active model layers using a shared DHT.
"""
from __future__ import annotations
import math

Loading…
Cancel
Save