Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TUS_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
TUS_public
Commits
c6fc1964
Commit
c6fc1964
authored
Aug 18, 2020
by
zqwerty
Committed by
zhuqi
Aug 24, 2020
Browse files
Options
Downloads
Patches
Plain Diff
remove fail book in multiwoz goal generator
parent
cb7796dc
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
convlab2/policy/rule/multiwoz/policy_agenda_multiwoz.py
+7
-1
7 additions, 1 deletion
convlab2/policy/rule/multiwoz/policy_agenda_multiwoz.py
convlab2/task/multiwoz/goal_generator.py
+22
-21
22 additions, 21 deletions
convlab2/task/multiwoz/goal_generator.py
with
29 additions
and
22 deletions
convlab2/policy/rule/multiwoz/policy_agenda_multiwoz.py
+
7
−
1
View file @
c6fc1964
...
...
@@ -391,6 +391,7 @@ class Agenda(object):
domain
=
goal
.
domains
[
idx
]
# inform
# first ask fail_info which return no result then ask info
if
'
fail_info
'
in
goal
.
domain_goals
[
domain
]:
for
slot
in
random_sample
(
goal
.
domain_goals
[
domain
][
'
fail_info
'
].
keys
(),
len
(
goal
.
domain_goals
[
domain
][
'
fail_info
'
])):
...
...
@@ -876,7 +877,9 @@ if __name__ == '__main__':
user_policy
.
init_session
()
sys_policy
.
init_session
()
print
(
user_policy
.
goal
)
goal
=
user_policy
.
get_goal
()
print
(
goal
)
print
(
user_policy
.
agenda
)
user_act
=
user_policy
.
predict
([])
...
...
@@ -895,6 +898,9 @@ if __name__ == '__main__':
print
(
user_act
)
user_utt
=
user_nlg
.
generate
(
user_act
)
print
(
user_utt
)
print
(
goal
)
sys_act
=
sys_policy
.
predict
(
state
)
print
(
sys_act
)
...
...
This diff is collapsed.
Click to expand it.
convlab2/task/multiwoz/goal_generator.py
+
22
−
21
View file @
c6fc1964
...
...
@@ -422,27 +422,27 @@ class GoalGenerator:
if
domain
==
'
train
'
and
len
(
domain_goal
[
'
book
'
])
<=
0
:
domain_goal
[
'
book
'
][
'
people
'
]
=
nomial_sample
(
cnt_slot_value
[
'
book
'
][
'
people
'
])
# fail_book
if
'
book
'
in
domain_goal
and
random
.
random
()
<
0.5
:
if
domain
==
'
hotel
'
:
domain_goal
[
'
fail_book
'
]
=
deepcopy
(
domain_goal
[
'
book
'
])
if
'
stay
'
in
domain_goal
[
'
book
'
]
and
random
.
random
()
<
0.5
:
# increase hotel-stay
domain_goal
[
'
fail_book
'
][
'
stay
'
]
=
str
(
int
(
domain_goal
[
'
book
'
][
'
stay
'
])
+
1
)
elif
'
day
'
in
domain_goal
[
'
book
'
]:
# push back hotel-day by a day
domain_goal
[
'
fail_book
'
][
'
day
'
]
=
days
[(
days
.
index
(
domain_goal
[
'
book
'
][
'
day
'
])
-
1
)
%
7
]
elif
domain
==
'
restaurant
'
:
domain_goal
[
'
fail_book
'
]
=
deepcopy
(
domain_goal
[
'
book
'
])
if
'
time
'
in
domain_goal
[
'
book
'
]
and
random
.
random
()
<
0.5
:
hour
,
minute
=
domain_goal
[
'
book
'
][
'
time
'
].
split
(
'
:
'
)
domain_goal
[
'
fail_book
'
][
'
time
'
]
=
str
((
int
(
hour
)
+
1
)
%
24
)
+
'
:
'
+
minute
elif
'
day
'
in
domain_goal
[
'
book
'
]:
if
random
.
random
()
<
0.5
:
domain_goal
[
'
fail_book
'
][
'
day
'
]
=
days
[(
days
.
index
(
domain_goal
[
'
book
'
][
'
day
'
])
-
1
)
%
7
]
else
:
domain_goal
[
'
fail_book
'
][
'
day
'
]
=
days
[(
days
.
index
(
domain_goal
[
'
book
'
][
'
day
'
])
+
1
)
%
7
]
# fail_book
: not use any more since 2020.8.18
#
if 'book' in domain_goal and random.random() < 0.5:
#
if domain == 'hotel':
#
domain_goal['fail_book'] = deepcopy(domain_goal['book'])
#
if 'stay' in domain_goal['book'] and random.random() < 0.5:
#
# increase hotel-stay
#
domain_goal['fail_book']['stay'] = str(int(domain_goal['book']['stay']) + 1)
#
elif 'day' in domain_goal['book']:
#
# push back hotel-day by a day
#
domain_goal['fail_book']['day'] = days[(days.index(domain_goal['book']['day']) - 1) % 7]
#
#
elif domain == 'restaurant':
#
domain_goal['fail_book'] = deepcopy(domain_goal['book'])
#
if 'time' in domain_goal['book'] and random.random() < 0.5:
#
hour, minute = domain_goal['book']['time'].split(':')
#
domain_goal['fail_book']['time'] = str((int(hour) + 1) % 24) + ':' + minute
#
elif 'day' in domain_goal['book']:
#
if random.random() < 0.5:
#
domain_goal['fail_book']['day'] = days[(days.index(domain_goal['book']['day']) - 1) % 7]
#
else:
#
domain_goal['fail_book']['day'] = days[(days.index(domain_goal['book']['day']) + 1) % 7]
# fail_info
if
'
info
'
in
domain_goal
and
len
(
self
.
db
.
query
(
domain
,
domain_goal
[
'
info
'
].
items
()))
==
0
:
...
...
@@ -453,6 +453,7 @@ class GoalGenerator:
if
domain
==
'
train
'
:
domain_goal
[
'
info
'
]
=
adjusted_info
else
:
# first ask fail_info which return no result then ask info
domain_goal
[
'
fail_info
'
]
=
domain_goal
[
'
info
'
]
domain_goal
[
'
info
'
]
=
adjusted_info
...
...
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