facebookresearch / facebookresearch/SlowFast

Is it possible to just use pre-trained model without GPU

Open
#39 6 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
7.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

```
def build_model(cfg):
"""
Builds the video model.
Args:
cfg (configs): configs that contains the hyper-parameters to build the
backbone. Details can be seen in slowfast/config/defaults.py.
"""
assert (
cfg.MODEL.ARCH in _MODEL_TYPES.keys()
), "Model type '{}' not supported".format(cfg.MODEL.ARCH)
assert (
cfg.NUM_GPUS <= torch.cuda.device_count()
), "Cannot use more GPU devices than available"

# Construct the model
model = _MODEL_TYPES[cfg.MODEL.ARCH](cfg)
# Determine the GPU used by the current process
cur_device = torch.cuda.current_device()
# Transfer the model to the current GPU device
model = model.cuda(device=cur_device)
# Use multi-process data parallel model in the multi-gpu setting
if cfg.NUM_GPUS > 1:
# Make model replica operate on the current device
model = torch.nn.parallel.DistributedDataParallel(
module=model, device_ids=[cur_device], output_device=cur_device
)
return model

```

I feel this project very intriguing But it seems like very sparse documentation.
I wanted to use the pre-trained SlowFast R-50 model but from the above code looks like to load the model I need GPU?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.