question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

module 'apex.amp' has no attribute 'initialize'?

See original GitHub issue

hi,this is my code,but it get an error shows:

AttributeError: module ‘apex.amp’ has no attribute ‘initialize’

what is the problem?thanks~

    from apex import amp
    model = build_detection_model(cfg)
    device = torch.device(cfg.MODEL.DEVICE)
    model.to(device)
    

    optimizer = make_optimizer(cfg, model)
    scheduler = make_lr_scheduler(cfg, optimizer)

    # Initialize mixed-precision training
    use_mixed_precision = cfg.DTYPE == "float16"
    amp_opt_level = 'O1' if use_mixed_precision else 'O0'
    model, optimizer = amp.initialize(model, optimizer, opt_level=amp_opt_level)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
xwjBuptcommented, May 9, 2019

hi @ptrblck, i reinstall the apex from source and problem solved

0reactions
fabrahmancommented, Jun 8, 2020

any solution fro this issue? I have tried putting it in the current working directory and also added --use when installing it, but still have the error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Apex AMP with PyTorch optimizers causes Attribute ...
Hi. I'm facing some issues when I'm trying to use PyTorch optimizers with Apex AMP. My environment is: OS: Ubuntu 18.04.5 Python: 3.8.5 ......
Read more >
Source code for apex.amp.frontend
__dict__["options"] if name in options: return options[name] raise AttributeError("'{}' object has no attribute '{}'".format( type(self).
Read more >
Python Examples of apex.amp.state_dict
__dict__: save_state['amp'] = amp.state_dict() if model_ema is not None: ... 'module') and not self.ema_has_module with torch.no_grad(): msd ...
Read more >
module 'torch.cuda' has no attribtue 'amp' 问题解决
之前没有使用过apex,所以使用apex的时候,发现报了一条错误。 ... 经过不断的尝试,终于找到了问题的原因。原因在于torch.cuda.amp是在torch1 ...
Read more >
module 'torch.distributed' has no attribute 'is_initialized' in ...
In order to solve this problem. Actually Window and Mac doesn't support distributed training facility. so this issue is occuring.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found