PVNet 4.1.4__tar.gz → 4.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pvnet-4.1.4 → pvnet-4.1.6}/PKG-INFO +1 -1
- {pvnet-4.1.4 → pvnet-4.1.6}/PVNet.egg-info/PKG-INFO +1 -1
- pvnet-4.1.6/pvnet/__init__.py +2 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/base_model.py +56 -15
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/model_cards/pv_india_model_card_template.md +5 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/model_cards/pv_uk_regional_model_card_template.md +5 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/model_cards/wind_india_model_card_template.md +5 -0
- pvnet-4.1.4/pvnet/__init__.py +0 -2
- {pvnet-4.1.4 → pvnet-4.1.6}/LICENSE +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/MANIFEST.in +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/PVNet.egg-info/SOURCES.txt +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/PVNet.egg-info/dependency_links.txt +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/PVNet.egg-info/requires.txt +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/PVNet.egg-info/top_level.txt +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/README.md +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/callbacks.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/data/__init__.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/data/base_datamodule.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/data/site_datamodule.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/data/uk_regional_datamodule.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/load_model.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/__init__.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/baseline/__init__.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/baseline/last_value.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/baseline/single_value.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/ensemble.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/__init__.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/basic_blocks.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/encoders/__init__.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/encoders/basic_blocks.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/encoders/encoders2d.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/encoders/encoders3d.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/encoders/encodersRNN.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/linear_networks/__init__.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/linear_networks/basic_blocks.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/linear_networks/networks.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/multimodal.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/multimodal_base.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/site_encoders/__init__.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/site_encoders/basic_blocks.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/site_encoders/encoders.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/multimodal/unimodal_teacher.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/models/utils.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/optimizers.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/training.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pvnet/utils.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/pyproject.toml +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/setup.cfg +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/tests/test_end2end.py +0 -0
- {pvnet-4.1.4 → pvnet-4.1.6}/tests/test_utils.py +0 -0
|
@@ -12,6 +12,7 @@ import hydra
|
|
|
12
12
|
import lightning.pytorch as pl
|
|
13
13
|
import matplotlib.pyplot as plt
|
|
14
14
|
import pandas as pd
|
|
15
|
+
import pkg_resources
|
|
15
16
|
import torch
|
|
16
17
|
import torch.nn.functional as F
|
|
17
18
|
import wandb
|
|
@@ -316,7 +317,7 @@ class PVNetModelHubMixin(PyTorchModelHubMixin):
|
|
|
316
317
|
push_to_hub: bool = False,
|
|
317
318
|
wandb_repo: Optional[str] = None,
|
|
318
319
|
wandb_ids: Optional[Union[list[str], str]] = None,
|
|
319
|
-
card_template_path=None,
|
|
320
|
+
card_template_path: Optional[Path] = None,
|
|
320
321
|
revision: str = "main",
|
|
321
322
|
**kwargs,
|
|
322
323
|
) -> Optional[str]:
|
|
@@ -366,6 +367,47 @@ class PVNetModelHubMixin(PyTorchModelHubMixin):
|
|
|
366
367
|
# Taylor the data config to the model being saved
|
|
367
368
|
minimize_data_config(new_data_config_path, new_data_config_path, self)
|
|
368
369
|
|
|
370
|
+
card = self.create_hugging_face_model_card(repo_id,
|
|
371
|
+
wandb_repo,
|
|
372
|
+
wandb_ids,
|
|
373
|
+
card_template_path)
|
|
374
|
+
|
|
375
|
+
(save_directory / "README.md").write_text(str(card))
|
|
376
|
+
|
|
377
|
+
if push_to_hub:
|
|
378
|
+
api = HfApi()
|
|
379
|
+
|
|
380
|
+
api.upload_folder(
|
|
381
|
+
repo_id=repo_id,
|
|
382
|
+
repo_type="model",
|
|
383
|
+
folder_path=save_directory,
|
|
384
|
+
revision=revision,
|
|
385
|
+
)
|
|
386
|
+
|
|
387
|
+
return None
|
|
388
|
+
|
|
389
|
+
@staticmethod
|
|
390
|
+
def create_hugging_face_model_card(repo_id: Optional[str] = None,
|
|
391
|
+
wandb_repo: Optional[str] = None,
|
|
392
|
+
wandb_ids: Optional[Union[list[str], str]] = None,
|
|
393
|
+
card_template_path: Optional[Path] = None
|
|
394
|
+
) -> ModelCard:
|
|
395
|
+
"""
|
|
396
|
+
Creates Hugging Face model card
|
|
397
|
+
|
|
398
|
+
Args:
|
|
399
|
+
repo_id (`str`, *optional*):
|
|
400
|
+
ID of your repository on the Hub. Used only if `push_to_hub=True`. Will default to
|
|
401
|
+
the folder name if not provided.
|
|
402
|
+
wandb_repo: Identifier of the repo on wandb.
|
|
403
|
+
wandb_ids: Identifier(s) of the model on wandb.
|
|
404
|
+
card_template_path: Path to the HuggingFace model card template. Defaults to card in
|
|
405
|
+
PVNet library if set to None.
|
|
406
|
+
|
|
407
|
+
Returns:
|
|
408
|
+
card: ModelCard - Hugging Face model card object
|
|
409
|
+
"""
|
|
410
|
+
|
|
369
411
|
# Get appropriate model card
|
|
370
412
|
model_name = repo_id.split("/")[1]
|
|
371
413
|
if model_name == "windnet_india":
|
|
@@ -390,26 +432,25 @@ class PVNetModelHubMixin(PyTorchModelHubMixin):
|
|
|
390
432
|
link = f"https://wandb.ai/{wandb_repo}/runs/{wandb_id}"
|
|
391
433
|
wandb_links += f" - [{link}]({link})\n"
|
|
392
434
|
|
|
435
|
+
# Find package versions for OCF packages
|
|
436
|
+
packages_to_display = ["pvnet", "ocf-data-sampler"]
|
|
437
|
+
packages_and_versions = {
|
|
438
|
+
package_name: pkg_resources.get_distribution(package_name).version
|
|
439
|
+
for package_name in packages_to_display
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
package_versions_markdown = ""
|
|
443
|
+
for package, version in packages_and_versions.items():
|
|
444
|
+
package_versions_markdown += f" - {package}=={version}\n"
|
|
445
|
+
|
|
393
446
|
card = ModelCard.from_template(
|
|
394
447
|
card_data,
|
|
395
448
|
template_path=card_template_path,
|
|
396
449
|
wandb_links=wandb_links,
|
|
450
|
+
package_versions=package_versions_markdown
|
|
397
451
|
)
|
|
398
452
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
if push_to_hub:
|
|
402
|
-
api = HfApi()
|
|
403
|
-
|
|
404
|
-
api.upload_folder(
|
|
405
|
-
repo_id=repo_id,
|
|
406
|
-
repo_type="model",
|
|
407
|
-
folder_path=save_directory,
|
|
408
|
-
revision=revision,
|
|
409
|
-
)
|
|
410
|
-
|
|
411
|
-
return None
|
|
412
|
-
|
|
453
|
+
return card
|
|
413
454
|
|
|
414
455
|
class BaseModel(pl.LightningModule, PVNetModelHubMixin):
|
|
415
456
|
"""Abstract base class for PVNet submodels"""
|
|
@@ -47,5 +47,10 @@ Trained on a single NVIDIA Tesla T4
|
|
|
47
47
|
|
|
48
48
|
### Software
|
|
49
49
|
|
|
50
|
+
This model was trained using the following Open Climate Fix packages:
|
|
51
|
+
|
|
50
52
|
- [1] https://github.com/openclimatefix/PVNet
|
|
51
53
|
- [2] https://github.com/openclimatefix/ocf-data-sampler
|
|
54
|
+
|
|
55
|
+
The versions of these packages can be found below:
|
|
56
|
+
{{ package_versions }}
|
|
@@ -50,5 +50,10 @@ Trained on a single NVIDIA Tesla T4
|
|
|
50
50
|
|
|
51
51
|
### Software
|
|
52
52
|
|
|
53
|
+
This model was trained using the following Open Climate Fix packages:
|
|
54
|
+
|
|
53
55
|
- [1] https://github.com/openclimatefix/PVNet
|
|
54
56
|
- [2] https://github.com/openclimatefix/ocf-data-sampler
|
|
57
|
+
|
|
58
|
+
The versions of these packages can be found below:
|
|
59
|
+
{{ package_versions }}
|
|
@@ -47,5 +47,10 @@ Trained on a single NVIDIA Tesla T4
|
|
|
47
47
|
|
|
48
48
|
### Software
|
|
49
49
|
|
|
50
|
+
This model was trained using the following Open Climate Fix packages:
|
|
51
|
+
|
|
50
52
|
- [1] https://github.com/openclimatefix/PVNet
|
|
51
53
|
- [2] https://github.com/openclimatefix/ocf-data-sampler
|
|
54
|
+
|
|
55
|
+
The versions of these packages can be found below:
|
|
56
|
+
{{ package_versions }}
|
pvnet-4.1.4/pvnet/__init__.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|