Skip to content

Commit

Permalink
Add revision to push_to_hub (#292)
Browse files Browse the repository at this point in the history
* Add revision to push_to_hub

* make style

* remove fairscale

* style happy

* Update modeling_base.py

* Update modeling_decoder.py
  • Loading branch information
philschmid authored Nov 6, 2023
1 parent 757886b commit 8abbcbd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 2 additions & 0 deletions optimum/neuron/modeling_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ def push_to_hub(
save_directory: str,
repository_id: str,
private: Optional[bool] = None,
revision: Optional[str] = None,
use_auth_token: Union[bool, str] = True,
endpoint: Optional[str] = None,
) -> str:
Expand Down Expand Up @@ -348,6 +349,7 @@ def push_to_hub(
repo_id=repository_id,
path_or_fileobj=os.path.join(os.getcwd(), local_file_path),
path_in_repo=hub_file_path,
revision=revision,
)

def forward(self, *args, **kwargs):
Expand Down
2 changes: 2 additions & 0 deletions optimum/neuron/modeling_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def push_to_hub(
save_directory: str,
repository_id: str,
private: Optional[bool] = None,
revision: Optional[str] = None,
use_auth_token: Union[bool, str] = True,
endpoint: Optional[str] = None,
) -> str:
Expand Down Expand Up @@ -290,4 +291,5 @@ def push_to_hub(
repo_id=repository_id,
path_or_fileobj=os.path.join(os.getcwd(), local_file_path),
path_in_repo=hub_file_path,
revision=revision,
)
5 changes: 0 additions & 5 deletions optimum/neuron/trainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import torch
from packaging import version
from transformers import PreTrainedModel, Seq2SeqTrainer, Trainer, TrainingArguments
from transformers.dependency_versions_check import dep_version_check
from transformers.integrations import is_fairscale_available
from transformers.modeling_utils import unwrap_model
from transformers.trainer import (
OPTIMIZER_NAME,
Expand Down Expand Up @@ -80,9 +78,6 @@
else:
IS_SAGEMAKER_MP_POST_1_10 = False

if is_fairscale_available():
dep_version_check("fairscale")


logger = logging.get_logger("transformers.trainer")

Expand Down

0 comments on commit 8abbcbd

Please sign in to comment.