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 tests #27

Merged
merged 3 commits into from
Aug 27, 2021
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
66 changes: 66 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
# Labels names are important as they are used by Release Drafter to decide
# regarding where to record them in changelog or if to skip them.
#
# The repository labels will be automatically configured using this file and
# the GitHub Action https://github.com/marketplace/actions/github-labeler.
- name: breaking
description: Breaking Changes
color: bfd4f2
- name: bug
description: Something isn't working
color: d73a4a
- name: build
description: Build System and Dependencies
color: bfdadc
- name: ci
description: Continuous Integration
color: 4a97d6
- name: dependencies
description: Pull requests that update a dependency file
color: 0366d6
- name: documentation
description: Improvements or additions to documentation
color: 0075ca
- name: duplicate
description: This issue or pull request already exists
color: cfd3d7
- name: new_method
description: New model/method/experiment
color: a2eeef
- name: github_actions
description: Pull requests that update Github_actions code
color: "000000"
- name: good first issue
description: Good for newcomers
color: 7057ff
- name: help wanted
description: Extra attention is needed
color: 008672
- name: invalid
description: This doesn't seem right
color: e4e669
- name: performance
description: Performance
color: "016175"
- name: question
description: Further information is requested
color: d876e3
- name: refactoring
description: Refactoring
color: ef67c4
- name: removal
description: Removals
color: 9ae7ea
- name: deprecation
description: Deprecations
color: 9ae7eb
- name: style
description: Code style, linting, typechecking, etc.
color: c120e5
- name: testing
description: Testing
color: b1fc6f
- name: wontfix
description: This will not be worked on
color: ffffff
66 changes: 66 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Changelog Generator

on:
push:
branches: [ master ]

jobs:
generate_changelog_file:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
token: {% raw %}${{ secrets.GH_TOKEN }}{% endraw %} # Need to use token to commit the changelog as admin.

- name: Generate changelog
uses: heinrichreimer/github-changelog-generator-action@v2.2
with:
token: {% raw %} ${{ secrets.GH_TOKEN }} {% endraw %}
author: true
unreleased: true
unreleasedLabel: "🚧Unreleased🚧"
issues: true
pullRequests: true
prWoLabels: true
compareLink: true
output: CHANGELOG.md
breakingLabel: "### 💥 Breaking Changes:"
breakingLabels: "breaking"
deprecatedLabel: "### 👋 Depricated"
deprecatedLabels: "deprecation"
enhancementLabel: "### ✨ Features and Enhancements:"
enhancementLabels: "enhancement"
bugsLabel: "### 🐛 Bug Fixes:"
bugLabels: "bug,bug-fix,fix,fixes"
removedLabel: '### 🗑️ Removals:'
removedLabels: 'removal'
addSections: >-
{
"documentation": {
"prefix":"### 📖 Documentation updates",
"labels":["documentation"]
},
"style": {
"prefix":"### 💄 Style",
"labels":["style"]
},
"dependencies": {
"prefix":"### 📦 Dependencies",
"labels":["dependencies"]
},
"refactoring": {
"prefix":"### 🔨 Refactoring",
"labels":["refactoring"]
},
"ci":{
"prefix":"### 👷 Testing and CI",
"labels":["ci", "test", "testing", "tests", "build"]
}
}
# See: emojipedia.org for emoji codes
- name: Commit CHANGELOG.md
uses: EndBug/add-and-commit@v7 # You can change this to use a specific version
if: success()
with:
add: 'CHANGELOG.md'
19 changes: 19 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Labeler

on:
push:
branches: [master]

jobs:
labeler:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2.3.4

- name: Run Labeler
if: success()
uses: crazy-max/ghaction-github-labeler@v3.1.1
with:
skip-delete: true
yaml-file: .github/labels.yml
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
long_description = fh.read()

install_requires = [
"allennlp>=2.0.0",
"allennlp>=2.5.0",
"wandb>=0.8.35",
"pyyaml",
"tensorboard",
Expand Down
2 changes: 1 addition & 1 deletion src/wandb_allennlp/commands/train_with_wandb.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def translate(
return all_args, hparams, env


@Subcommand.register("train_with_wandb")
@Subcommand.register("train-with-wandb")
class TrainWithWandb(WandbParserBase):
description = "Train with logging to wandb"
help_message = (
Expand Down
1 change: 0 additions & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ flake8-black
pre-commit
darglint
coverage
allennlp-models
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ local int_value = std.parseJson(std.extVar('int_value'));
type: 'train_test_log_to_wandb',
evaluate_on_test: true,
dataset_reader: {
type: 'snli',
token_indexers: {
tokens: {
type: 'single_id',
lowercase_tokens: true,
},
},
type: 'dummy',
},
train_data_path: data_path + '/snli_1.0_test/snli_1.0_train.jsonl',
validation_data_path: data_path + '/snli_1.0_test/snli_1.0_dev.jsonl',
Expand All @@ -29,10 +23,7 @@ local int_value = std.parseJson(std.extVar('int_value'));

},
data_loader: {
batch_sampler: {
type: 'bucket',
batch_size: 64,
},
batch_size: 2,
},
trainer: {
optimizer: {
Expand Down
43 changes: 0 additions & 43 deletions tests/configs/parameter_tying_v1.0.jsonnet

This file was deleted.

52 changes: 0 additions & 52 deletions tests/configs/parameter_tying_v2.0.jsonnet

This file was deleted.

13 changes: 12 additions & 1 deletion tests/models/dummy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from typing import List, Tuple, Union, Dict, Any, Optional
import torch
import allennlp
from allennlp.models import Model
from allennlp.data.vocabulary import Vocabulary
from allennlp.data.dataset_readers import DatasetReader
from allennlp.data.fields import TensorField
from allennlp.data.instance import Instance


@Model.register("dummy")
Expand Down Expand Up @@ -47,7 +51,14 @@ def __init__(
assert d == 1
self.x = 0

def forward(self, *args, **kwargs):
def forward(self, *args: Any, **kwargs: Any):
self.x += 1

return {"loss": self.a * self.x + self.b + self.param}


@DatasetReader.register("dummy")
class Dummy(DatasetReader):
def _read(self, file_path: str):
for i in range(10):
yield Instance({"x": TensorField(torch.tensor([i]))})
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: parameter_tying_test_console_script_v0.2.4
name: v1.0.0
program: allennlp
command:
- ${program} #omit the interpreter as we use allennlp train command directly
- "train_with_wandb" # subcommand
- "configs/parameter_tying_v0.2.4.jsonnet"
- "train-with-wandb" # subcommand
- "configs/parameter_tying_v1.0.0.jsonnet"
- "--include-package=models" # add all packages containing your registered classes here
- "--include-package=allennlp_models"
- ${args}
method: bayes
metric:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_single_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ def test_run(script_runner):
ret = script_runner.run(
"allennlp",
"train-with-wandb",
"configs/parameter_tying_v0.2.4.jsonnet",
"configs/parameter_tying_v1.0.0.jsonnet",
"--wandb-entity=dhruveshpate",
"--wandb-project=wandb-allennlp-wandb_allennlp_tests",
"--wandb-name=plugging_test_run",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def test_sweep(script_runner):
"wandb",
"agent",
"--count=1",
"dhruveshpate/wandb-allennlp-wandb_allennlp_tests/k1a8rfwt",
"dhruveshpate/wandb-allennlp-wandb_allennlp_tests/rttyf5i3",
)
assert ret.success
assert "wandb: Program ended successfully." in ret.stderr
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ deps =
{toxinidir}
pytest
pytest-console-scripts
allennlp2.5.0: allennlp-models==2.5.0

changedir={toxinidir}/tests
commands =
Expand Down