15,919,245 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Linlin Zeng (Top 5 by date)
Linlin Zeng
21-Jul-21 5:25am
View
okay; I found when running :
'''
TEXT.vocab.vectors.size()
'''
--> torch.Size([4, 300])
since the size should be 479 * 300; maybe I build a wrong vocab?
Linlin Zeng
21-Jul-21 5:23am
View
Sorry for misunderstanding your reply; I am using following packages;
'''import spacy
import pandas as pd
from torchtext.legacy.data import Field, TabularDataset, BucketIterator, LabelField
from sklearn.model_selection import train_test_split
from torchtext.vocab import GloVe'''
for batch in dataset_iter:
batch.text[0]
batch.term_index[0]
it suppose to print:
torchtext.data.batch.Batch of size 10
.text torch.cuda.LongTensor of size 104*10
.term_index torch.cuda.LongTensor of size 104*10;
just tell the batch can be run successfully
Linlin Zeng
21-Jul-21 5:03am
View
TEXT.vocab.vectors.size() # torch.Size([4, 300])
I suppose when building vocab, there is something wrong
'''
import spacy
import pandas as pd
from torchtext.legacy.data import Field, TabularDataset, BucketIterator, LabelField
from sklearn.model_selection import train_test_split
from torchtext.vocab import GloVe
'''
This is all packages I used; not import bird
Linlin Zeng
21-Jul-21 3:50am
View
oh; actually, it is more helpful if you can tell me how to modify it
Linlin Zeng
21-Jul-21 3:48am
View
dataset_iter = Iterator(
train, batch_size=10,
train=True, shuffle= True)
here dataset_iter is an iteration of train after using batch size; train is a tabular dataset after using Field to transfer word into tensors.