现在,Anaconda 上的官方 TensorFlow 是 2.0。我的问题是如何强制 Anaconda 安装早期版本的 TensorFlow。因此,例如,我希望 Anaconda 安装 TensorFlow 1.14,因为我的很多项目都依赖于这个版本。
现在,我正在写硕士论文,需要在 GCP 上训练一个巨大的 Transformer 模型。而训练深度学习模型最快的方法就是使用 GPU。所以,我想知道我应该使用 GCP 提供的 GPU 中的哪一个?目前可用的有:
\n我经常用于GridSearchCV超参数调整。例如,用于调整逻辑回归C中的正则化参数。每当我使用的估计器有自己的参数时,我都会很困惑在哪里设置它,是在估计器中还是在 中,还是在两者中?同样的情况也适用于.n_jobsGridSearchCVcross_validate
我有 scikit-learn 0.24.1 和 scikit-optimize 0.8.1,当我尝试使用 BayesSearchCV 函数时,它给了我这个错误:
TypeError: __init__() got an unexpected keyword argument 'iid'
Run Code Online (Sandbox Code Playgroud)
当我搜索时发现新的 scikit-learn 中不推荐使用“iid”,有什么建议可以解决这个问题?
推荐人:https : //github.com/librosa/librosa/blob/master/examples/LibROSA%20demo.ipynb
代码:
import librosa
S = librosa.feature.melspectrogram(samples, sr=sample_rate, n_mels=128)
log_S = librosa.power_to_db(S, ref=np.max)
plt.figure(figsize=(12,4))
librosa.display.specshow(log_S, sr=sample_rate, x_axis='time', y_axis='mel')
plt.title('mel power spectrogram')
plt.colorbar(format='%+02.0f dB')
plt.tight_layout()
Run Code Online (Sandbox Code Playgroud)
我得到的错误:
正如标题所示,我有一个音频文件,我想将通道数更改为任意数字...知道通道数可以是 8 我该怎么做。它不必是单声道或立体声。
有些人建议使用sox,但如果您知道其他工具也没关系
使用Python插入多个MySQL记录错误:Python“元组”无法转换为MySQL类型
错误代码:
Traceback (most recent call last):
File "C:\Users\POM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\conversion.py", line 181, in to_mysql
return getattr(self, "_{0}_to_mysql".format(type_name))(value)
AttributeError: 'MySQLConverter' object has no attribute '_tuple_to_mysql'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\POM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\cursor.py", line 432, in _process_params
res = [to_mysql(i) for i in res]
File "C:\Users\POM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\cursor.py", line 432, in <listcomp>
res = [to_mysql(i) for i in res]
File "C:\Users\POM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mysql\connector\conversion.py", line 184, in to_mysql
"MySQL type".format(type_name))
TypeError: Python 'tuple' cannot be converted to a MySQL …Run Code Online (Sandbox Code Playgroud) 我尝试了 ner 的 spacy,但结果非常难以预测。有时 spacy 无法识别特定的国家。任何人都可以解释为什么会发生这种情况吗?我尝试了一些随机句子。
情况1:
nlp = spacy.load("en_core_web_sm")
print(nlp)
sent = "hello china hello japan"
doc = nlp(sent)
for i in doc.ents:
print(i.text," ",i.label_)
Run Code Online (Sandbox Code Playgroud)
输出:在这种情况下没有输出。
案例2:
nlp = spacy.load("en_core_web_sm")
print(nlp)
sent = "china is a populous nation in East Asia whose vast landscape encompasses grassland, desert, mountains, lakes, rivers and more than 14,000km of coastline."
doc = nlp(sent)
for i in doc.ents:
print(i.text," ",i.label_)
Run Code Online (Sandbox Code Playgroud)
输出:
<spacy.lang.en.English object at 0x7f2213bde080>
china GPE
East Asia LOC
more than 14,000km QUANTITY
Run Code Online (Sandbox Code Playgroud) 我想更正法语文本中拼写错误的单词,似乎 spacy 是最准确、最快速的软件包,但它很复杂,我尝试使用 textblob,但我没有设法用法语单词完成
它在英语中完美运行,但是当我尝试用法语做同样的事情时,我得到了相同的拼写错误
#english words
from textblob import TextBlob
misspelled=["hapenning", "mornin", "windoow", "jaket"]
[str(TextBlob(word).correct()) for word in misspelled]
#french words
misspelled2=["resaissir", "matinnée", "plonbier", "tecnicien"]
[str(TextBlob(word).correct()) for word in misspelled2]
Run Code Online (Sandbox Code Playgroud)
我明白了:
英语:['发生','早上','窗口','夹克']
法语:['resaissir'、'matinnée'、'plonbier'、'tecnicien']
python ×7
anaconda ×2
nlp ×2
scikit-learn ×2
spacy ×2
audio ×1
cloud ×1
gpu ×1
gridsearchcv ×1
installation ×1
librosa ×1
mysql ×1
nvidia ×1
python-3.x ×1
skopt ×1
sox ×1
speech ×1
tensorflow ×1
textblob ×1
version ×1