![](/img/trans.png)
[英]How to bring pytorch datasets into pandas dataframe
我看過很多關於如何將 pandas 數據轉換為 pytorch 數據集的代碼。 但是,我還沒有找到或無法弄清楚相反的做法。 ie Load pytorch dataset into pandas dataframe。我想把AG新聞加載到pandas。你能幫忙嗎? 謝謝。 from torchte ...
[英]How to bring pytorch datasets into pandas dataframe
我看過很多關於如何將 pandas 數據轉換為 pytorch 數據集的代碼。 但是,我還沒有找到或無法弄清楚相反的做法。 ie Load pytorch dataset into pandas dataframe。我想把AG新聞加載到pandas。你能幫忙嗎? 謝謝。 from torchte ...
[英]module ‘torchtext.data‘ has no attribute ‘LabelField‘
我正在嘗試像這樣導入數據: from torchtext import data 當我嘗試像這樣使用 data.LabelField 時: LABEL = data.LabelField(dtype = torch.float) 它顯示此錯誤: module 'torchtext.data' ha ...
[英]What do I do wrong when install OpenKiwi?
我嘗試使用OpenKiwi到 Anaconda3 並在安裝后(pip install openkiwi)執行以下代碼(我這樣做是因為我想創建openkiwi 詞匯表): 而且我有一條錯誤消息: Anaconda3 有以下版本: >! 火炬閃電:1.7.6 pytorch-nlp:0.5. ...
[英]Error when importing torchtext.data.datasets_utils
我試圖導入torchtext,但即使在嘗試使用不同版本后也會出錯。 我得到如下所示的錯誤。 我的 torch 和 torchtext 版本如下。 ...
[英]How to add modules from torchtext.data?
我正在嘗試from torchtext.data import TabularDataset, Field, LabelField, BucketIterator執行此操作,但是,出現以下異常: ImportError:無法從“torchtext.data”導入名稱“TabularDataset ...
[英]how to pad a text after build the vocab in pytorch
我使用 torchtext vocab 將文本轉換為索引,但是在將它們發送到網絡之前,我應該使用哪個 function 使所有索引列表的長度相同? 例如,我有 2 個文本: 詞后: 我想要的是: ...
[英]Unable to build vocab for a torchtext text classification
我正在嘗試准備從 csv 文件加載的自定義數據集,以便在 torchtext 文本二進制分類問題中使用。 這是一個基本數據集,包含新聞標題和市場情緒 label 被分配為“正面”或“負面”。 我一直在關注 PyTorch 上的一些在線教程以達到這一點,但他們在最新的 torchtext packag ...
[英]ImportError: cannot import name 'unicode_csv_reader' from 'torchtext.utils'
我正在嘗試從 torchtext 導入這些庫 - 數據、字段、LabelField、TabularDataset、BucketIterator 但我有這個錯誤。 有人可以建議如何解決這個問題嗎? 太感謝了。 ...
[英]How to create an iterable DataPipe with PyTorch using txt files
我有兩個文本文件來訓練變壓器模型。 但是,我沒有使用 PyTorch 自己的數據集,而是使用從 Internet 下載的內容。 使用上面的代碼,我在一個名為“source”的列表中有一些丹麥語句子,它們在另一個名為“target”的列表中翻譯成英語句子。 我的問題是,如何使用 PyTorch ...
[英]Missmatching target size in criterion
我正在嘗試將 pytorch 用於 IMBD 數據集,以預測正面和負面評論。 當我進入訓練狀態時, criterion函數給出以下錯誤: 經過一番研究,我發現錯誤是因為模型的輸出返回了一個大小為[1136, 64, 1]的張量,而criterion只期望batch結果。 但是,我不知道如何解決 ...
[英]How to load data from csv with torchtext 0.12.0
我試圖找出為 Torchtext 加載 csv 數據集的新方法,但我找不到任何明確的解釋。 給定一個包含兩列的 csv: text, class ,我可以找到的所有關於 torchtext 加載數據的教程如下: 以上從這個 git 存儲庫修改 但我找不到任何關於使用較新版本的 torchtex ...
[英]AttributeError: module 'torchtext' has no attribute 'legacy'
我正在嘗試使用 torchtext 來處理測試數據,但是,當我運行以下代碼時,出現錯誤:“AttributeError: module 'torchtext' has no attribute 'legacy'”。 誰能指導我這里的問題是什么? 我正在使用 python 3.10.4。 謝謝 ...
[英]TorchText Vocab TypeError: Vocab.__init__() got an unexpected keyword argument 'min_freq'
我正在研究 CNN 情感分析機器學習 model,它使用 Torchtext 庫提供的 IMDb 數據集。 在我的一行代碼中vocab = Vocab(counter, min_freq = 1, specials=('\<unk\>', '\<BOS\>', '\< ...
[英]Using torchtext vocab with torchscript
我正在嘗試將 torchtext vocab 層與 torchscript 一起使用,但我遇到了一些錯誤,我想知道這里是否有人讓它工作。 我現在的model是 當我像這樣傳遞 model 時,這會起作用: 但是當我嘗試用 torchscript 編譯它時,它失敗了: 出現以下錯誤: 對於當我 ma ...
[英]NLP: How to look at sentence encoding in torchtext?
TEXT = data.Field(tokenize = 'spacy', tokenizer_language = 'en_core_web_sm', include_lengths = True) LABEL = data ...
[英]Unable to create a custom torchtext BucketIterator
我正在嘗試使用 LSTM 創建一個 POS 標記器,但在准備數據時遇到了一些困難。 我已成功遵循使用以下代碼准備數據迭代器的指南: 然后在訓練 model 時,代碼為: 現在對於我的問題 - 我有一個列表數據集:句子列表(其中每個句子都是單詞列表)和對應於句子單詞的標簽列表列表。 我從 x_tra ...
[英]Save and load vocab and weight for torchtext to do inference
我已經按照這個示例使用 torchtext 構建了一個文本分類器。 完成訓練后,我保存了詞匯和權重,但是當我再次加載它們以使用驗證數據進行推斷時,我的准確性為零。 我發現了一個類似的問題Using torchtext for inference但它不能解決我的問題 謝謝。 ...
[英]"Token second\team not found and default index is not set" error in torchtext function
這是我的代碼,function 適用於訓練集,但對於測試集返回此錯誤RuntimeError: Token second\team not found and default index is not set 有誰知道出了什么問題? ...
[英]Get frequency of words using Vocab in pytorch Torchtext
如何在使用 build_vocab_from_iterator 創建的 torchtext vocab 中獲取標記的頻率? 文檔鏈接: https://pytorch.org/text/stable/vocab.html#torchtext.vocab.Vocab ...
[英]AttributeError: 'Field' object has no attribute 'vocab' preventing me to run the code
我找到了這段代碼,我想看看我在最后一行打印的 object 是什么。 我是 nlp 領域的新手,所以請幫我修復此代碼,因為它給出AttributeError: 'Field' object has no attribute 'vocab'錯誤。 順便說一句,我發現 torchtext 已更改,錯誤可 ...