MCPcopy Create free account
hub / github.com/modelscope/modelscope / place_model

Method place_model

modelscope/trainers/trainer.py:295–301  ·  view source on GitHub ↗

Place model to device, or to DDP

(self)

Source from the content-addressed store, hash-verified

293 self.model = Swift.prepare_model(self.model, efficient_tuners)
294
295 def place_model(self):
296 """Place model to device, or to DDP
297 """
298 if self.device.type == 'cuda':
299 self.model.to(self.device)
300 if not is_parallel(self.model) and self._dist:
301 self.model = self.to_parallel(self.model)
302
303 def get_data_collator(self, data_collator, remove_unused_data=False):
304 """Get the data collator for both training and evaluating.

Callers

nothing calls this directly

Calls 3

to_parallelMethod · 0.95
is_parallelFunction · 0.85
toMethod · 0.45

Tested by

no test coverage detected