Different results when run with tensor parallelism
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 536
- Avg merge
- 12h 12m
- Merged PRs (30d)
- 4
Description
Hi,
I was running Flan-t5 XXL with ctranslate2 and observed completely different results when run with tensor parallelism.
To convert from HF to CT2:
ct2-transformers-converter --model google/flan-t5-xxl --output_dir flan-t5-xxl --quantization bfloat16
Code:
import ctranslate2
import transformers
translator = ctranslate2.Translator("flan-t5-xxl", device="cuda", tensor_parallel=True)
tokenizer = transformers.AutoTokenizer.from_pretrained("google/flan-t5-xxl")
input_text = "Who is president of united states?"
input_tokens = tokenizer.convert_ids_to_tokens(tokenizer.encode(input_text))
results = translator.translate_batch([input_tokens], return_scores=True)
if ctranslate2.MpiInfo.getCurRank() == 0:
output_tokens = results[0].hypotheses[0]
output_text = tokenizer.decode(tokenizer.convert_tokens_to_ids(output_tokens))
print("Output tokens: ", output_tokens)
print("Output text: ", output_text)
print("Score: ", results[0].scores[0])
Outputs:
Case 1: No TP
When run as python run.py or mpirun -n 1 python run.py
Output tokens: ['▁Barack', '▁Obama']
Output text: Barack Obama
Score: -0.609375
Case 2: With TP
When run as mpirun -n 2 python run.py
Output tokens: ['▁', 'john', '▁', 'f', '▁', 'kenn', 'e', 'd', 'y']
Output text: john f kennedy
Score: -0.5375000238418579
I hope this is not an expected behaviour.
Further, with v4.3.0, I get an extra error at the end (after the output) which I didn't use to get with v4.1.0 (with the same code). The error goes like this:
[servername:18378] *** Process received signal ***
[servername:18378] Signal: Aborted (6)
[servername:18378] Signal code: (-6)
[servername:18378] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x12980)[0x7fcc96109980]
[servername:18378] [ 1] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7fcc9559fe87]
[servername:18378] [ 2] /lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7fcc955a17f1]
[servername:18378] [ 3] /home/subha/miniconda3/envs/inf2/bin/../lib/libstdc++.so.6(+0xb135a)[0x7fcc839f435a]
[servername:18378] [ 4] /home/subha/miniconda3/envs/inf2/bin/../lib/libstdc++.so.6(+0xb13c5)[0x7fcc839f43c5]
[servername:18378] [ 5] /home/subha/miniconda3/envs/inf2/bin/../lib/libstdc++.so.6(+0xb1658)[0x7fcc839f4658]
[servername:18378] [ 6] /home/subha/miniconda3/envs/inf2/lib/python3.10/site-packages/ctranslate2/../ctranslate2.libs/libctranslate2-acb10d87.so.4.3.0(+0x25fb20)[0x7fcc83db6b20]
[servername:18378] [ 7] /lib/x86_64-linux-gnu/libc.so.6(+0x43031)[0x7fcc955a4031]
[servername:18378] [ 8] /lib/x86_64-linux-gnu/libc.so.6(+0x4312a)[0x7fcc955a412a]
[servername:18378] [ 9] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xee)[0x7fcc95582c8e]
[servername:18378] [10] python[0x58852e]
[servername:18378] *** End of error message ***
Aborted (core dumped)
Your help would be greatly appreciated.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported Flan-T5 XXL conversion and translation commands, comparing single-process and mpirun -n 2 tensor-parallel outputs. Trace the tensor-parallel execution path and the shutdown behavior associated with the reported abort; done means consistent outputs across both modes and no post-run error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- distributed-systems, machine-learning, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100