GithubHelp home page GithubHelp logo

end-to-end-negotiator's Introduction

Introduction

This is a PyTorch implementation of the following research papers:

The code is developed by Facebook AI Research.

The code trains neural networks to hold negotiations in natural language, and allows reinforcement learning self play and rollout-based planning.

Citation

If you want to use this code in your research, please cite:

@inproceedings{DBLP:conf/icml/YaratsL18,
  author    = {Denis Yarats and
               Mike Lewis},
  title     = {Hierarchical Text Generation and Planning for Strategic Dialogue},
  booktitle = {Proceedings of the 35th International Conference on Machine Learning,
               {ICML} 2018, Stockholmsm{\"{a}}ssan, Stockholm, Sweden, July
               10-15, 2018},
  pages     = {5587--5595},
  year      = {2018},
  crossref  = {DBLP:conf/icml/2018},
  url       = {http://proceedings.mlr.press/v80/yarats18a.html},
  timestamp = {Fri, 13 Jul 2018 14:58:25 +0200},
  biburl    = {https://dblp.org/rec/bib/conf/icml/YaratsL18},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}

Dataset

We release our dataset together with the code, you can find it under data/negotiate. This dataset consists of 5808 dialogues, based on 2236 unique scenarios. Take a look at §2.3 of the paper to learn about data collection.

Each dialogue is converted into two training examples in the dataset, showing the complete conversation from the perspective of each agent. The perspectives differ on their input goals, output choice, and in special tokens marking whether a statement was read or written. See §3.1 for the details on data representation.

# Perspective of Agent 1
<input> 1 4 4 1 1 2 </input>
<dialogue> THEM: i would like 4 hats and you can have the rest . <eos> YOU: deal <eos> THEM: <selection> </dialogue>
<output> item0=1 item1=0 item2=1 item0=0 item1=4 item2=0 </output> 
<partner_input> 1 0 4 2 1 2 </partner_input>

# Perspective of Agent 2
<input> 1 0 4 2 1 2 </input>
<dialogue> YOU: i would like 4 hats and you can have the rest . <eos> THEM: deal <eos> YOU: <selection> </dialogue>
<output> item0=0 item1=4 item2=0 item0=1 item1=0 item2=1 </output>
<partner_input> 1 4 4 1 1 2 </partner_input>

Setup

All code was developed with Python 3.0 on CentOS Linux 7, and tested on Ubuntu 16.04. In addition, we used PyTorch 1.0.0, CUDA 9.0, and Visdom 0.1.8.4.

We recommend to use Anaconda. In order to set up a working environment follow the steps below:

# Install anaconda
conda create -n py30 python=3 anaconda
# Activate environment
source activate py30
# Install PyTorch
conda install pytorch torchvision cuda90 -c pytorch
# Install Visdom if you want to use visualization
pip install visdom

Usage

Supervised Training

Action Classifier

We use an action classifier to compare performance of various models. The action classifier is described in section 3 of (2). It can be trained by running the following command:

python train.py \
--cuda \
--bsz 16 \
--clip 2.0 \
--decay_every 1 \
--decay_rate 5.0 \
--domain object_division \
--dropout 0.1 \
--init_range 0.2 \
--lr 0.001 \
--max_epoch 7 \
--min_lr 1e-05 \
--model_type selection_model \
--momentum 0.1 \
--nembed_ctx 128 \
--nembed_word 128 \
--nhid_attn 128 \
--nhid_ctx 64 \
--nhid_lang 128 \
--nhid_sel 128 \
--nhid_strat 256 \
--unk_threshold 20 \
--skip_values \
--sep_sel \
--model_file selection_model.th

Baseline RNN Model

This is the baseline RNN model that we describe in (1):

python train.py \
--cuda \
--bsz 16 \
--clip 0.5 \
--decay_every 1 \
--decay_rate 5.0 \
--domain object_division \
--dropout 0.1 \
--model_type rnn_model \
--init_range 0.2 \
--lr 0.001 \
--max_epoch 30 \
--min_lr 1e-07 \
--momentum 0.1 \
--nembed_ctx 64 \
--nembed_word 256 \
--nhid_attn 64 \
--nhid_ctx 64 \
--nhid_lang 128 \
--nhid_sel 128 \
--sel_weight 0.6 \
--unk_threshold 20 \
--sep_sel \
--model_file rnn_model.th

Hierarchical Latent Model

In this section we provide guidelines on how to train the hierarchical latent model from (2). The final model requires two sub-models: the clustering model, which learns compact representations over intents; and the language model, which translates intent representations into language. Please read sections 5 and 6 of (2) for more details.

Clustering Model

python train.py \
--cuda \
--bsz 16 \
--clip 2.0 \
--decay_every 1 \
--decay_rate 5.0 \
--domain object_division \
--dropout 0.2 \
--init_range 0.3 \
--lr 0.001 \
--max_epoch 15 \
--min_lr 1e-05 \
--model_type latent_clustering_model \
--momentum 0.1 \
--nembed_ctx 64 \
--nembed_word 256 \
--nhid_ctx 64 \
--nhid_lang 256 \
--nhid_sel 128 \
--nhid_strat 256 \
--unk_threshold 20 \
--num_clusters 50 \
--sep_sel \
--skip_values \
--nhid_cluster 256 \
--selection_model_file selection_model.th \
--model_file clustering_model.th

Language Model

python train.py \
--cuda \
--bsz 16 \
--clip 2.0 \
--decay_every 1 \
--decay_rate 5.0 \
--domain object_division \
--dropout 0.1 \
--init_range 0.2 \
--lr 0.001 \
--max_epoch 15 \
--min_lr 1e-05 \
--model_type latent_clustering_language_model \
--momentum 0.1 \
--nembed_ctx 64 \
--nembed_word 256 \
--nhid_ctx 64 \
--nhid_lang 256 \
--nhid_sel 128 \
--nhid_strat 256 \
--unk_threshold 20 \
--num_clusters 50 \
--sep_sel \
--nhid_cluster 256 \
--skip_values \
--selection_model_file selection_model.th \
--cluster_model_file clustering_model.th \
--model_file clustering_language_model.th

Full Model

python train.py \
--cuda \
--bsz 16 \
--clip 2.0 \
--decay_every 1 \
--decay_rate 5.0 \
--domain object_division \
--dropout 0.2 \
--init_range 0.3 \
--lr 0.001 \
--max_epoch 10 \
--min_lr 1e-05 \
--model_type latent_clustering_prediction_model \
--momentum 0.2 \
--nembed_ctx 64 \
--nembed_word 256 \
--nhid_ctx 64 \
--nhid_lang 256 \
--nhid_sel 128 \
--nhid_strat 256 \
--unk_threshold 20 \
--num_clusters 50 \
--sep_sel \
--selection_model_file selection_model.th \
--lang_model_file clustering_language_model.th \
--model_file full_model.th

Selfplay

If you want to have two pretrained models to negotiate against each another, use selfplay.py. For example, lets have two rnn models to play against each other:

python selfplay.py \
--cuda \
--alice_model_file rnn_model.th \
--bob_model_file rnn_model.th \
--context_file data/negotiate/selfplay.txt  \
--temperature 0.5 \
--selection_model_file selection_model.th

The script will output generated dialogues, as well as some statistics. For example:

================================================================================
Alice : book=(count:3 value:1) hat=(count:1 value:5) ball=(count:1 value:2)
Bob   : book=(count:3 value:1) hat=(count:1 value:1) ball=(count:1 value:6)
--------------------------------------------------------------------------------
Alice : i would like the hat and the ball . <eos>
Bob   : i need the ball and the hat <eos>
Alice : i can give you the ball and one book . <eos>
Bob   : i can't make a deal without the ball <eos>
Alice : okay then i will take the hat and the ball <eos>
Bob   : okay , that's fine . <eos>
Alice : <selection>
Alice : book=0 hat=1 ball=1 book=3 hat=0 ball=0
Bob   : book=3 hat=0 ball=0 book=0 hat=1 ball=1
--------------------------------------------------------------------------------
Agreement!
Alice : 7 points
Bob   : 3 points
--------------------------------------------------------------------------------
dialog_len=4.47 sent_len=6.93 agree=86.67% advantage=3.14 time=2.069s comb_rew=10.93 alice_rew=6.93 alice_sel=60.00% alice_unique=26 bob_rew=4.00 bob_sel=40.00% bob_unique=25 full_match=0.78 
--------------------------------------------------------------------------------
debug: 3 1 1 5 1 2 item0=0 item1=1 item2=1
debug: 3 1 1 1 1 6 item0=3 item1=0 item2=0
================================================================================

Reinforcement Learning

To fine-tune a pretrained model with RL use the reinforce.py script:

python reinforce.py \
--cuda \
--alice_model_file rnn_model.th \
--bob_model_file rnn_model.th \
--output_model_file rnn_rl_model.th \
--context_file data/negotiate/selfplay.txt  \
--temperature 0.5 \
--verbose \
--log_file rnn_rl.log \
--sv_train_freq 4 \
--nepoch 4 \
--selection_model_file selection_model.th  \
--rl_lr 0.00001 \
--rl_clip 0.0001 \
--sep_sel

License

This project is licenced under CC-by-NC, see the LICENSE file for details.

end-to-end-negotiator's People

Contributors

bkgoksel avatar colin-r-schultz avatar denisyarats avatar facebook-github-bot avatar greenmonn avatar pierreneter avatar plugimi avatar senya-ashukha avatar soumith avatar zredlined avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

end-to-end-negotiator's Issues

non-empty torch.LongTensor is ambiguous

Hi,
When I ran the reinforce.py, I got the following error.
** Since my machine doesn't have GPU, I ran train.py and reinforce.py without --cuda.
** I also got the same error when running selfplay.py.
Thanks.

(py30) [root@localhost src]# python reinforce.py --data data/negotiate --bsz 16 --clip 1 --context_file data/negotiate/selfplay.txt --eps 0.0 --gamma 0.95 --lr 0.5 --momentum 0.1 --nepoch 1 --nesterov --ref_text data/negotiate/train.txt --rl_clip 1 --rl_lr 0.1 --score_threshold 6 --sv_train_freq 4 --temperature 0.5 --alice_model sv_model.th --bob_model sv_model.th --output_model_file rl_model.th
Traceback (most recent call last):
File "reinforce.py", line 165, in
main()
File "reinforce.py", line 159, in main
reinforce.run()
File "reinforce.py", line 57, in run
self.dialog.run(ctxs, self.logger)
File "/root/end-to-end-negotiator-master/src/dialog.py", line 170, in run
out = writer.write()
File "/root/end-to-end-negotiator-master/src/agent.py", line 329, in write
100, self.args.temperature)
File "/root/end-to-end-negotiator-master/src/models/dialog_model.py", line 282, in write
if inpt:
File "/root/anaconda3/envs/py30/lib/python3.6/site-packages/torch/autograd/variable.py", line 123, in bool
torch.typename(self.data) + " is ambiguous")
RuntimeError: bool value of Variable objects containing non-empty torch.LongTensor is ambiguous

Questions about arguments in reinforce script

Hello.

I have a few questions. I would be grateful if you answer them.

Could you please tell me what the argument is and what it affects?
parser.add_argument('--smart_bob', action='store_true', default=False, help='make Bob smart again')

In Deal or No Deal? End-to-End Learning for Negotiation Dialogues in 6.1: During reinforcement learning, we use a learning rate of 0.1, clip gradients above 1.0, and use a discount factor of γ=0.95.
But in reinforce.py: parser.add_argument('--gamma', type=float, default=0.99, help='discount factor'). It matters to learning?

Also in reinforce.py we see: 'parser.add_argument('--clip', type=float, default=0.1, help='gradient clip') In report: clip gradients above 1.0

Reinforce learning rate and gradient clip. In script default value is:
parser.add_argument('--rl_lr', type=float, default=0.002, help='RL learning rate')
parser.add_argument('--rl_clip', type=float, default=2.0, help='RL gradient clip')
In code snippet in readme file: --rl_lr 0.00001 \ --rl_clip 0.0001 \ It matters to learning?

How long does it take to execute the script reinforce with arguments from snippet?

During training, a large number of dialogs appear in which one of the agents repeats one word a large number of times. It' ok?

Dimension out of range for Softmax in dialog_model.py

I am getting this error when I try to run reinforce.py.
Traceback (most recent call last): File "reinforce.py", line 164, in <module> main() File "reinforce.py", line 158, in main reinforce.run() File "reinforce.py", line 57, in run self.dialog.run(ctxs, self.logger) File "/home/ss8464/dl/nego_comm/main/src/dialog.py", line 170, in run out = writer.write() File "/home/ss8464/dl/nego_comm/main/src/agent.py", line 128, in write 100, self.args.temperature) File "/home/ss8464/dl/nego_comm/main/src/models/dialog_model.py", line 300, in write prob = F.softmax(scores) File "/share/apps/pytorch/20171124/python3.6/gnu/lib/python3.6/site-packages/torch/nn/functional.py", line 818, in softmax return torch._C._nn.softmax(input, dim) RuntimeError: dimension out of range (expected to be in range of [-1, 0], but got 1)

Running without GPU

Hello,

It's possible running the project without GPU?

I tried to install and configure the project, but I didn't work.

Thanks

Models File

Hello,

Could you please provide the "rl_model.th" and "sv_model.th" models file?

Thanks

User ids and timestamps

Is it possible to share some unprocessed raw dataset or at least share anonymized userids and timestamps?

Would appreciate it a lot :)

Human chat with full model

Hi,

I have two questions:

  1. How can I make human chat with full model version. I noticed that chat.py is disabled.
  2. The dialogues generated by full model version is very short, even shorter than original RNN version. What is the reason?

Look forward to your reply!

Type error: expected str, bytes or os.PathLike object, not int

`import shapefile, csv

funtion to generate a .prj file

def getWKT_PRJ (epsg_code):
import urllib
wkt = urllib.urlopen("http://spatialreference.org/ref/epsg/{0}/prettywkt/".format(epsg_code))
remove_spaces = wkt.read().replace(" ","")
output = remove_spaces.replace("\n", "")
return output

create a point shapefile

trees_shp = shapefile.Writer(shapefile.POINT)

for every record there must be a corresponding geometry.

trees_shp.autoBalance = 1

create the field names and data type for each.

trees_shp.field("TREE_ID", "C")
trees_shp.field("ADDRESS", "C")
trees_shp.field("TOWN", "C")
trees_shp.field("TREE_SPEC", "C")
trees_shp.field("SPEC_DESC", "C")
trees_shp.field("COMMONNAME", "C")
trees_shp.field("AGE_DESC", "C")
trees_shp.field("HEIGHT", "C")
trees_shp.field("SPREAD", "C")
trees_shp.field("TRUNK", "C")
trees_shp.field("TRUNK_ACTL", "C")
trees_shp.field("CONDITION", "C")

count the features

counter = 1

access the CSV file

with open('D:\ARCHIVOS\ARCGIS_FOLDER\csvToShape\Trees.csv', 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter=',')

skip the header

next(reader, None)

#loop through each of the rows and assign the attributes to variables
for row in reader:
tree_id = row[0]
address = row[1]
town = row[2]
tree_species = row[3]
species_desc = row[4]
common_name = row[5]
age_desc = row[6]
height = row[7]
spread = row[8]
trunk = row[9]
trunk_actual = row[10]
condition = row[11]
latitude = row[12]
longitude = row[13]

create the point geometry

trees_shp.point(float(longitude),float(latitude))

add attribute data

trees_shp.record(tree_id, address, town, tree_species, species_desc, common_name, age_desc,height, spread, trunk, trunk_actual, condition)

print("Feature " + str(counter) + " added to Shapefile.")
counter = counter + 1

save the Shapefile

trees_shp.save("D:/ARCHIVOS/ARCGIS_FOLDER/csvToShape/shapes/Fingal_Trees")

create a projection file

prj = open("D:/ARCHIVOS/ARCGIS_FOLDER/csvToShape/shapes/Fingal_Trees.prj", "w")
epsg = getWKT_PRJ("4326")
prj.write(epsg)
prj.close()`

In the terminal of spyder:
Python 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 6.5.0 -- An enhanced Interactive Python.

runfile('D:/ARCHIVOS/ARCGIS_FOLDER/csvToShape/py/CsvToShape.py', wdir='D:/ARCHIVOS/ARCGIS_FOLDER/csvToShape/py')
Traceback (most recent call last):

File "", line 1, in
runfile('D:/ARCHIVOS/ARCGIS_FOLDER/csvToShape/py/CsvToShape.py', wdir='D:/ARCHIVOS/ARCGIS_FOLDER/csvToShape/py')

File "C:\Users\Alvaro\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 668, in runfile
execfile(filename, namespace)

File "C:\Users\Alvaro\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "D:/ARCHIVOS/ARCGIS_FOLDER/csvToShape/py/CsvToShape.py", line 14, in
trees_shp = shapefile.Writer(shapefile.POINT)

File "D:\ARCHIVOS\PythonModules\pyshp-2.0.1\shapefile.py", line 1017, in init
self.shp = self.__getFileObj(os.path.splitext(target)[0] + '.shp')

File "C:\Users\Alvaro\Anaconda3\lib\ntpath.py", line 202, in splitext
p = os.fspath(p)

TypeError: expected str, bytes or os.PathLike object, not int`

I don't know what the problem is.

dead code reported by vulture

We used vulture (https://github.com/jendrikseipp/vulture) to search
for unused code in your project. You can find the report below. It
would be great if you could give us feedback about which items are
actually used or unused. This would allow us to improve vulture and
ideally it also helps you to remove obsolete code or even find typos
and bugs.

Command:

vulture end-to-end-negotiator/src

Raw results:

end-to-end-negotiator/src/agent.py:12: Unused import 'autograd'
end-to-end-negotiator/src/metric.py:156: Unused function 'register_similarity'
end-to-end-negotiator/src/models/dialog_model.py:54: Unused attribute 'weight_ih'
end-to-end-negotiator/src/models/dialog_model.py:55: Unused attribute 'weight_hh'
end-to-end-negotiator/src/models/dialog_model.py:56: Unused attribute 'bias_ih'
end-to-end-negotiator/src/models/dialog_model.py:57: Unused attribute 'bias_hh'
end-to-end-negotiator/src/models/dialog_model.py:92: Unused function 'set_device_id'
end-to-end-negotiator/src/models/modules.py:27: Unused function 'init_rnn_cell'
end-to-end-negotiator/src/utils.py:15: Unused function 'backward_hook'
end-to-end-negotiator/src/utils.py:49: Unused function 'prob_random'
end-to-end-negotiator/src/utils.py:70: Unused variable 'e'

Obvious false-positives:

end-to-end-negotiator/src/utils.py:70: Unused variable 'e'

Please have a look at: jendrikseipp/vulture#51

Unused code:

end-to-end-negotiator/src/agent.py:12: Unused import 'autograd'

There might be false positives, which can be prevented by adding them to a
whitelist file. You may find more info here

Regards,
vulture team

Invalid argument 2: dimension 2 out of range of 2D tensor

Hello,

When the code below is run a error is throwed. Could someone help me with this problem?

ps: cuda support is disabled.

# concatenate attention and context hidden and pass it to the selection encoder
h = torch.cat([attn, ctx_h], 2).squeeze(0)
h = self.dropout(h)
h = self.sel_encoder.forward(h)

python train.py data data/negotiate
--bsz 16
--clip 0.5
--decay_every 1
--decay_rate 5.0
--dropout 0.5
--init_range 0.1
--lr 1
--max_epoch 30
--min_lr 0.01
--momentum 0.1
--nembed_ctx 64
--nembed_word 256
--nesterov
--nhid_attn 256
--nhid_ctx 64
--nhid_lang 128
--nhid_sel 256
--nhid_strat 128
--sel_weight 0.5
--model_file sv_model.th
dataset data/negotiate/train.txt, total 687919, unks 8718, ratio 1.27%
dataset data/negotiate/val.txt, total 74653, unks 914, ratio 1.22%
dataset data/negotiate/test.txt, total 70262, unks 847, ratio 1.21%
Traceback (most recent call last):
File "train.py", line 105, in
main()
File "train.py", line 98, in main
train_loss, valid_loss, select_loss = engine.train(corpus)
File "/Users/diegosoaresub/Downloads/facebookIA/end-to-end-negotiator-master/src/engine.py", line 193, in train
_, _, valid_select_loss = self.iter(N, epoch, lr, traindata, validdata)
File "/Users/diegosoaresub/Downloads/facebookIA/end-to-end-negotiator-master/src/engine.py", line 161, in iter
train_loss, train_time = self.train_pass(N, trainset)
File "/Users/diegosoaresub/Downloads/facebookIA/end-to-end-negotiator-master/src/engine.py", line 104, in train_pass
out, hid, tgt, sel_out, sel_tgt = Engine.forward(self.model, batch, volatile=False)
File "/Users/diegosoaresub/Downloads/facebookIA/end-to-end-negotiator-master/src/engine.py", line 84, in forward
sel_out = model.forward_selection(inpt, lang_h, ctx_h)
File "/Users/diegosoaresub/Downloads/facebookIA/end-to-end-negotiator-master/src/models/dialog_model.py", line 178, in forward_selection
h = torch.cat([attn, ctx_h], 2).squeeze(0)
File "/Users/diegosoaresub/anaconda/lib/python3.6/site-packages/torch/autograd/variable.py", line 897, in cat
return Concat.apply(dim, *iterable)
File "/Users/diegosoaresub/anaconda/lib/python3.6/site-packages/torch/autograd/_functions/tensor.py", line 316, in forward
ctx.input_sizes = [i.size(dim) for i in inputs]
File "/Users/diegosoaresub/anaconda/lib/python3.6/site-packages/torch/autograd/_functions/tensor.py", line 316, in
ctx.input_sizes = [i.size(dim) for i in inputs]
RuntimeError: invalid argument 2: dimension 2 out of range of 2D tensor at /Users/soumith/miniconda2/conda-bld/pytorch_1502000975045/work/torch/lib/TH/generic/THTensor.c:24

training: value cannot be converted without overflow

Dear Community
I have the following message during python train.py
"Traceback (most recent call last):
File "train.py", line 105, in
main()
File "train.py", line 98, in main
train_loss, valid_loss, select_loss = engine.train(corpus)
File "/Users/ra312/Documents/GitHub/end-to-end-negotiator/src/engine.py", line 195, in train
if valid_select_loss < best_valid_select_loss:
RuntimeError: value cannot be converted to type float without overflow: 10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104.000000"
I did as instructed. Any help is appreciated.
I launched train.py in condo environment py30. In this environment, I installed two packages:PyTorch and Visdom. The operating system is MacOs High Sierra 10.13.4

CUDA not available. Unable to train

Hi,
when I run
"python train.py --data data/negotiate --cuda --bsz 16 --clip 0.5 --decay_every 1 --decay_rate 5.0 --dropout 0.5 --init_range 0.1 --lr 1 --max_epoch 30 --min_lr 0.01 --momentum 0.1 --nembed_ctx 64 --nembed_word 256 --nesterov --nhid_attn 256 --nhid_ctx 64 --nhid_lang 128 --nhid_sel 256 --nhid_strat 128 --sel_weight 0.5 --model_file sv_model.th"

I get the assertion fail error that CUDA not available. I do not have GPU on my machine. CUDA wont work due to that.

Is there any way forward for training without GPU?

Thanks for the help.

How To Get the Dataset

Hi, thanks for this release, I really like to play with it, but how to get the datasets? seems not included in repo.

Reinfrocement Learning with full_model

Hello.

If I use full_model.th in reinforcment learning script: python reinforce.py
--cuda
--alice_model_file full_model.th
--bob_model_file full_model.th
--output_model_file rl_model.th
--context_file data/negotiate/selfplay.txt
--temperature 0.5
--verbose
--log_file rnn_rl.log
--sv_train_freq 4
--nepoch 4
--selection_model_file selection_model.th
--rl_lr 0.00001
--rl_clip 0.0001
--sep_sel

I have this:

Traceback (most recent call last):
File "/home/.../end-to-end-negotiator/src/reinforce.py", line 169, in
main()
File "/home/.../end-to-end-negotiator/src/reinforce.py", line 163, in main
reinforce.run()
File "/home/.../end-to-end-negotiator/src/reinforce.py", line 51, in run
self.dialog.run(ctxs, self.logger)
File "/home/.../end-to-end-negotiator/src/dialog.py", line 171, in run
out = writer.write(max_words=words_left)
File "/home/.../end-to-end-negotiator/src/agent.py", line 1661, in write
_, lat_h, log_q_z = self.model.forward_prediction(self.cnt, self.mem_h, sample=self.train)
File "/home/.../end-to-end-negotiator/src/models/latent_clustering_model.py", line 541, in forward_prediction
z = q_z.multinomial().detach()
TypeError: multinomial() missing 1 required positional arguments: "num_samples"

torch==1.0.0

Config has no attribute rl_temperature

Hi, when running reinforce.py I get the following error, any idea what may be causing this? Thanks!

File "reinforce.py", line 95, in main
    parser.add_argument('--temperature', type=float, default=config.rl_temperature,
AttributeError: module 'config' has no attribute 'rl_temperature'

pytorch0.4.1 does work for me

pytorch0.4.1 does work for me, but pytorch1.0.0 works. when I use 0.4.1, it shows "mean is not a valid value for reduction" (it should be "elementwise_mean" in 0.4.1)

Tensor dimensionality mismatch in reinforce.py

Hi, I'm trying to reproduce the results.
I've cloned this repo and ran the supervised training step (with the recommended command given on the readme) successfully, however running reinforce.py with the given command crashes with a Tensor dimensionality mismatch in the RLAgent, (more specifically lang_hs and words have different numbers of dimensions).

Here's the command I ran:

 ✘ python3 reinforce.py \
     --data data/negotiate \
     --bsz 16 \
     --clip 1 \
     --context_file data/negotiate/selfplay.txt \
     --eps 0.0 \
     --gamma 0.95 \
     --lr 0.5 \
     --momentum 0.1 \
     --nepoch 4 \
     --nesterov \
     --ref_text data/negotiate/train.txt \
     --rl_clip 1 \
     --rl_lr 0.2 \
     --score_threshold 6 \
     --sv_train_freq 4 \
     --temperature 0.5 \
     --alice_model sv_model.th \
     --bob_model sv_model.th \
     --output_model_file rl_model.th

Here's the output:


/home/bkgoksel/negotiate/negotiator/src/models/dialog_model.py:300: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
  prob = F.softmax(scores)
/home/bkgoksel/negotiate/negotiator/src/models/dialog_model.py:301: UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to include dim=X as an argument.
  logprob = F.log_softmax(scores)
Traceback (most recent call last):
  File "reinforce.py", line 164, in <module>
    main()
  File "reinforce.py", line 158, in main
    reinforce.run()
  File "reinforce.py", line 57, in run
    self.dialog.run(ctxs, self.logger)
  File "/home/bkgoksel/negotiate/negotiator/src/dialog.py", line 170, in run
    out = writer.write()
  File "/home/bkgoksel/negotiate/negotiator/src/agent.py", line 337, in write
    assert (torch.cat(self.words).size()[0] == torch.cat(self.lang_hs).size()[0])
RuntimeError: invalid argument 0: Tensors must have same number of dimensions: got 1 and 2 at /pytorch/torch/lib/TH/generic/THTensorMath.c:2888

This is my environment:

  • Ubuntu 16.04
  • python 3.5.2
  • pytorch from pip3 install http://download.pytorch.org/whl/cpu/torch-0.3.1-cp35-cp35m-linux_x86_64.whl .
  • Running on CPU (no CUDA)

I was working on some extensions and I have a local copy that fixes this issue for me, so if you also think that this is a bug, I can probably make a PR with a fix.

TypeError: expected str, bytes or os.PathLike object, not NoneType

Hi,
I'm new to artificial intelligence, machine learning and also python. I tried to implement this research as a part of my final dissertation on CentOS 7. After installing anaconda and all other tools and dependencies, when i executed "train.py" file, it took about 20 minutes, and finished fine. But then after I tried to look for where it has saved the trained model , I couldnt find it.
I wanted to chat with it myself so I executed "chat.py", but it gave me an error saying
"utils.py line 35
with open(file_name, 'rb') as f:
TypeError: expected str, bytes or os.PathLike object, not NoneType"
I dont know if I was supposed to make any changes in the code or not, please let me know if I need to and also where?
Thank you.

Expecting torch.Longtensor but found type torch.Inttensor

In Moules.py file Line no 107 and 108 only 2 arguments are passed.
cnt = ctx.index_select(0, cnt_idx)
val = ctx.index_select(0, val_idx)

But as per documentation (https://pytorch.org/docs/stable/torch.html) 3 arguments are passed.
I am getting below error.
"RunTimeError: Expected object of type torch.Longtensor but found of type torch.Inttensor ".
I try to typecast it as follows: cnt = ctx.index_select(0, torch.Longtensor(cnt_idx)). But still got the same error.

I am using python 3.7 . So what might be the issue?

Thanks

Human evaluation code

Hi folks,

First off, I really enjoyed reading this paper and I think this is a promising technique for developing dialog agents. I wanted to ask how one can reproduce the human evaluation results from the paper. Obviously, exact reproducibility is impossible due to the nature of the human annotators. But is the evaluation script available? Do you release scripts to facilitate the process of playing against human opponents and collecting the results of the negotiation?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.