Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
emoUS-public
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
dsml
emoUS-public
Commits
f9e8c088
Commit
f9e8c088
authored
2 years ago
by
Carel van Niekerk
Browse files
Options
Downloads
Patches
Plain Diff
Fix pickling error of TransformerForDST Trippy Class
parent
6923cac0
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
convlab/dst/trippy/modeling_dst.py
+2
-2
2 additions, 2 deletions
convlab/dst/trippy/modeling_dst.py
convlab/dst/trippy/tracker.py
+8
-3
8 additions, 3 deletions
convlab/dst/trippy/tracker.py
with
10 additions
and
5 deletions
convlab/dst/trippy/modeling_dst.py
+
2
−
2
View file @
f9e8c088
...
@@ -62,7 +62,7 @@ def TransformerForDST(parent_name):
...
@@ -62,7 +62,7 @@ def TransformerForDST(parent_name):
class
TransformerForDST
(
PARENT_CLASSES
[
parent_name
]):
class
TransformerForDST
(
PARENT_CLASSES
[
parent_name
]):
def
__init__
(
self
,
config
):
def
__init__
(
self
,
config
):
assert
config
.
model_type
in
PARENT_CLASSES
assert
config
.
model_type
in
PARENT_CLASSES
assert
self
.
__class__
.
__bases__
[
0
]
in
MODEL_CLASSES
#
assert self.__class__.__bases__[0] in MODEL_CLASSES
super
(
TransformerForDST
,
self
).
__init__
(
config
)
super
(
TransformerForDST
,
self
).
__init__
(
config
)
self
.
model_type
=
config
.
model_type
self
.
model_type
=
config
.
model_type
self
.
slot_list
=
config
.
dst_slot_list
self
.
slot_list
=
config
.
dst_slot_list
...
@@ -82,7 +82,7 @@ def TransformerForDST(parent_name):
...
@@ -82,7 +82,7 @@ def TransformerForDST(parent_name):
self
.
refer_index
=
-
1
self
.
refer_index
=
-
1
# Make sure this module has the same name as in the pretrained checkpoint you want to load!
# Make sure this module has the same name as in the pretrained checkpoint you want to load!
self
.
add_module
(
self
.
model_type
,
MODEL_CLASSES
[
self
.
__class__
.
__bases__
[
0
]](
config
))
self
.
add_module
(
self
.
model_type
,
MODEL_CLASSES
[
PARENT_CLASSES
[
self
.
model_type
]](
config
))
if
self
.
model_type
==
"
electra
"
:
if
self
.
model_type
==
"
electra
"
:
self
.
pooler
=
ElectraPooler
(
config
)
self
.
pooler
=
ElectraPooler
(
config
)
...
...
This diff is collapsed.
Click to expand it.
convlab/dst/trippy/tracker.py
+
8
−
3
View file @
f9e8c088
...
@@ -30,10 +30,15 @@ from convlab.dst.trippy.modeling_dst import (TransformerForDST)
...
@@ -30,10 +30,15 @@ from convlab.dst.trippy.modeling_dst import (TransformerForDST)
from
convlab.dst.trippy.dataset_interfacer
import
(
create_dataset_interfacer
)
from
convlab.dst.trippy.dataset_interfacer
import
(
create_dataset_interfacer
)
from
convlab.util
import
relative_import_module_from_unified_datasets
from
convlab.util
import
relative_import_module_from_unified_datasets
class
BertForDST
(
TransformerForDST
(
'
bert
'
)):
pass
class
RobertaForDST
(
TransformerForDST
(
'
roberta
'
)):
pass
class
ElectraForDST
(
TransformerForDST
(
'
electra
'
)):
pass
MODEL_CLASSES
=
{
MODEL_CLASSES
=
{
'
bert
'
:
(
BertConfig
,
Transform
erForDST
(
'
bert
'
)
,
BertTokenizer
),
'
bert
'
:
(
BertConfig
,
B
er
t
ForDST
,
BertTokenizer
),
'
roberta
'
:
(
RobertaConfig
,
TransformerForDST
(
'
roberta
'
)
,
RobertaTokenizer
),
'
roberta
'
:
(
RobertaConfig
,
RobertaForDST
,
RobertaTokenizer
),
'
electra
'
:
(
ElectraConfig
,
TransformerForDST
(
'
electra
'
)
,
ElectraTokenizer
),
'
electra
'
:
(
ElectraConfig
,
ElectraForDST
,
ElectraTokenizer
),
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment