Skip to content

Fairscale pipeline - #35

Draft
mrzzd wants to merge 9 commits into
gh/pbelevich/3/headfrom
fairscale-pipeline
Draft

Fairscale pipeline#35
mrzzd wants to merge 9 commits into
gh/pbelevich/3/headfrom
fairscale-pipeline

Conversation

@mrzzd

@mrzzd mrzzd commented Jul 8, 2021

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread BERT/main.py
WorkerModule("worker3", pipeline_on_devices(1, 4, n_encoders=args.nlayers // 3), MLMTaskSharder, ntokens, args.emsize, args.nhead, args.nhid, args.dropout),
WorkerModule("worker4", pipeline_on_devices(6, 3, n_encoders=args.nlayers // 6, n_encoders_on_first_gpu=args.nlayers // 6, include_head=True), MLMTaskSharder, ntokens, args.emsize, args.nhead, args.nhid, args.dropout),
)
layers = [RemoteModule("w0/cuda:0", MLMTaskEmbedding, (ntokens, args.emsize))]

@mrzzd mrzzd Jul 8, 2021

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of RemoteModule("w0/cuda:0", MLMTaskEmbedding, (ntokens, args.emsize))
Do:
MLMTaskEmbedding(ntokens, args.emsize).to('cuda:0')

for old implementation

Comment thread BERT/main.py

graph = make_graph(org_model)
#for node in graph.nodes: print(node.module.on, node.get_name())
model = DistributedPipeline(graph, chunks=8)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of creating graph and model this way, just do: model=Pipe(org_model)
for old implementation

Comment thread BERT/main.py
this_encoders = n_encoders // (7-i)
layers.append(RemoteModule(device, MLMTaskEncoder, (args.emsize, args.nhead, args.nhid, this_encoders, args.dropout)))
n_encoders -= this_encoders
layers.append(RemoteModule("w7/cuda:7", MLMTaskHead, (ntokens, args.emsize)))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w7/cuda:7 -> cuda:7

Comment thread BERT/main.py
assert args.world_size % args.num_workers == 0

#run_worker(args.rank, args.world_size, args)
mp.spawn(run_worker, args=(args,), nprocs=args.world_size // args.num_workers)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use mp.spawn -- all the ranks will be 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants