Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Resolve issues with PR checks #3270

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8'
architecture: x64

- name: install deps
Expand Down
2 changes: 1 addition & 1 deletion aim/pytorch_lightning.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Alias to SDK PyTorch Lightning interface
from aim.sdk.adapters.pytorch_lightning import AimLogger # noqa F401
from aim.sdk.adapters.pytorch_lightning import AimLogger # noqa F401
14 changes: 8 additions & 6 deletions aim/sdk/adapters/pytorch_lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ def __init__(
self,
repo: Optional[str] = None,
experiment: Optional[str] = None,
train_metric_prefix: Optional[str] = 'train_', # deprecated
val_metric_prefix: Optional[str] = 'val_', # deprecated
test_metric_prefix: Optional[str] = 'test_', # deprecated
train_metric_prefix: Optional[str] = 'train_', # deprecated
val_metric_prefix: Optional[str] = 'val_', # deprecated
test_metric_prefix: Optional[str] = 'test_', # deprecated
system_tracking_interval: Optional[int] = DEFAULT_SYSTEM_TRACKING_INT,
log_system_params: Optional[bool] = True,
capture_terminal_logs: Optional[bool] = True,
Expand Down Expand Up @@ -89,7 +89,9 @@ def __init__(
context_prefixes.pop('subset')
# context_prefixes is now empty {}
elif train_metric_prefix != 'train_' or val_metric_prefix != 'val_' or test_metric_prefix != 'test_':
raise ValueError('Arguments "train_metric_prefix" "val_metric_prefix" "train_metric_prefix" cannot be used in conjunction with "context_prefixes".')
raise ValueError(
'Arguments "train_metric_prefix" "val_metric_prefix" "train_metric_prefix" cannot be used in conjunction with "context_prefixes".'
)
# Deprecation warnings if SUBSET_metric_prefix arguments are not default
if train_metric_prefix != 'train_':
msg = 'The argument "train_metric_prefix" is deprecated. Consider using "context_prefixes" instead.'
Expand Down Expand Up @@ -180,14 +182,14 @@ def parse_context(self, name):
for ctx, mappings in self._context_prefixes.items():
for category, prefix in mappings.items():
if name.startswith(prefix):
name = name[len(prefix):]
name = name[len(prefix) :]
context[ctx] = category
break # avoid prefix rename cascade

for ctx, mappings in self._context_postfixes.items():
for category, postfix in mappings.items():
if name.endswith(postfix):
name = name[:-len(postfix)]
name = name[: -len(postfix)]
context[ctx] = category
break # avoid postfix rename cascade

Expand Down
5 changes: 3 additions & 2 deletions aim/sdk/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,11 @@ def track(

# artifacts logging API
@property
def artifacts_uri(self) -> str:
def artifacts_uri(self) -> Optional[str]:
if self._run_artifacts_uri is None:
base_uri = self.meta_run_tree.get('artifacts_uri', None)
if base_uri is None: return None
if base_uri is None:
return None
self._run_artifacts_uri = os.path.join(base_uri, self.hash)
return self._run_artifacts_uri

Expand Down
6 changes: 5 additions & 1 deletion aim/storage/artifacts/s3_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,19 @@ def _get_s3_client(self):
def S3ArtifactStorage_factory(**boto3_client_kwargs: dict):
class S3ArtifactStorageCustom(S3ArtifactStorage):
def _get_s3_client(self):
import boto3, botocore
import boto3
import botocore

if 'config' in boto3_client_kwargs and isinstance(boto3_client_kwargs['config'], dict):
config_kwargs = boto3_client_kwargs.pop('config')
boto3_client_kwargs['config'] = botocore.config.Config(**config_kwargs)
client = boto3.client('s3', **boto3_client_kwargs)
return client

return S3ArtifactStorageCustom


def S3ArtifactStorage_clientconfig(**boto3_client_kwargs: dict):
from aim.storage.artifacts import registry

registry.registry['s3'] = S3ArtifactStorage_factory(**boto3_client_kwargs)
Loading