提问人:Aisyah Robi 提问时间:10/2/2023 最后编辑:Aisyah Robi 更新时间:10/2/2023 访问量:94
我正在使用深度学习运行语音活动检测,我遇到了这个错误
I'm running voice activity detection using deep learning, I'm stuck with this error
问:
我正在尝试运行Python train.py,并出现了此错误:
AttributeError:“CacheManager”对象没有属性“cachedir”
我试图寻找解决方案,但没有找到任何解决方案。我正在研究深度学习语音活动检测
这是针对 \site-packeages\librosa\cache.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Function caching"""
import os
import sys
from joblib import Memory
class CacheManager(Memory):
'''The librosa cache manager class extends joblib.Memory
with a __call__ attribute, so that it may act as a function.
This allows us to override the librosa.cache module's __call__
field, thereby allowing librosa.cache to act as a decorator function.
'''
def __init__(self, cachedir, level=10, **kwargs):
super(CacheManager, self).__init__(cachedir, **kwargs)
# The level parameter controls which data we cache
# smaller numbers mean less caching
self.level = level
def __call__(self, level):
'''Example usage:
@cache(level=2)
def semi_important_function(some_arguments):
...
'''
def wrapper(function):
'''Decorator function. Adds an input/output cache to
the specified function.'''
from decorator import FunctionMaker
def decorator_apply(dec, func):
"""Decorate a function by preserving the signature even if dec
is not a signature-preserving decorator.
This recipe is derived from
http://micheles.googlecode.com/hg/decorator/documentation.html#id14
"""
return FunctionMaker.create(
func, 'return decorated(%(signature)s)',
dict(decorated=dec(func)), __wrapped__=func)
if self.cachedir is not None and self.level >= level:
return decorator_apply(self.cache, function)
else:
return function
return wrapper
# Instantiate the cache from the environment
CACHE = CacheManager(os.environ.get('LIBROSA_CACHE_DIR', None),
mmap_mode=os.environ.get('LIBROSA_CACHE_MMAP', None),
compress=os.environ.get('LIBROSA_CACHE_COMPRESS', False),
verbose=int(os.environ.get('LIBROSA_CACHE_VERBOSE', 0)),
level=int(os.environ.get('LIBROSA_CACHE_LEVEL', 10)))
# Override the module's __call__ attribute
sys.modules[__name__] = CACHE
第 49 行,在包装器中 如果 self.cachedir 不是 None 且 self.level >= level: AttributeError:“CacheManager”对象没有属性“cachedir”
答: 暂无答案
评论
CacheManager
cachedir