ray1007 / pytorch-word2vec

41 stars 9 forks source link

wrong shape and 2 small notes #5

Closed transfluxus closed 6 years ago

transfluxus commented 6 years ago

Hey, the readme reads great. I tried but ran into an error that is pops up 4 times: Process Process-1:1: - Process Process-4:1: complaining about the shape. The second time it says could not broadcast input array from shape (80,12) into shape (80,22) the other times
ValueError: could not broadcast input array from shape (100,12) into shape (100,22)

./main.py --cuda --train parsed_v3_valid.txt --output w2v.txt  --cbow 0 --size 300 --window 5 --sample 1e-4 --negative 5 --min_count 5 --processes 4 --iter 1 --batch_size 100
Starting training using file parsed_v3_valid.txt
108652
Vocab size: 165011
Words in train file: 95087032
Process Process-1:1:
Traceback (most recent call last):
  File "/usr/lib/python3.5/multiprocessing/process.py", line 249, in _bootstrap
    self.run()
  File "/usr/lib/python3.5/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/pytorch/pytorch-word2vec/main.py", line 298, in train_process_sent_producer
    batch_placeholder[batch_count:batch_count+take_from_chunk, :] = chunk[chunk_pos:chunk_pos+take_from_chunk, :]
ValueError: could not broadcast input array from shape (100,12) into shape (100,22)
Process Process-2:1:
...

With that I have another question and a note: What does [CUDA_VISIBLE_DEVICES=<device_id>] for? what would I need to write for example?

also, there is a type. It says neagative instead of negative. keep it up. looks great!

ray1007 commented 6 years ago

Hi transfluxus, Thanks for the report, the error and typos are fixed in the current commit! Please let me know if you encounter any other bugs. :)

[CUDA_VISIBLE_DEVICES=<device_id>] is optional, if you have multiple GPUs, set this flag to use a specific one. For example if you have 4 GPUs (and their ids = 0,1,2,3), you could use CUDA_VISIBLE_DEVICES=1, to choose the second one.

Tzu-Ray