-
Notifications
You must be signed in to change notification settings - Fork 59
Add code for sentiment analysis #417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sanketverma1704
wants to merge
32
commits into
gramener:master
Choose a base branch
from
sanketverma1704:jd-transformers
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 24 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
e1ec479
WIP
jaidevd 4f5b50d
WIP: MLHandler support for Huggingface transformers
jaidevd 52e72cb
WIP
jaidevd 4b01634
WIP
jaidevd 1f85677
Ensure label IDs are long ints
jaidevd 6af50ea
FIX: Enforce correct order of features before prediction in MLHandler
jaidevd a3fa51f
WIP
jaidevd 2322e8e
Merge branch 'jd-mlhandler-featnames-order' of github.com:gramener/gr…
jaidevd e6be0d5
WIP: MLHandler Refactoring
jaidevd 2a30092
Merge branch 'master' of github.com:gramener/gramex into jd-transformers
jaidevd 8317fe1
ENH: Transfomers - model persistence
jaidevd 2d5b213
WIP
jaidevd 168c7e1
Merge branch 'master' of github.com:gramener/gramex into jd-transformers
jaidevd 3775939
WIP
jaidevd d446803
ENH: Modify gramex.install.safe_rmtree to remove files outside $GRAME…
jaidevd 80b6c27
Add code for sentiment analysis and remove print statements
sanketverma1704 13116a0
Remove print statement
sanketverma1704 7f40258
Solve merge conflicts
sanketverma1704 dac5359
Add space
sanketverma1704 e9c6bb2
Add new install.py
sanketverma1704 07807c7
Remove space
sanketverma1704 4ee107d
Remove merge conflicts test_mlhandler.py
sanketverma1704 20ce370
Merge branch 'master' into jd-transformers
sanketverma1704 e4f59e0
Remove unnecessary space & lines
sanketverma1704 2f00a8e
Restore formhandler.py to original version & Minor Change to mlhandle…
sanketverma1704 e84a064
Remove unused function
sanketverma1704 dd3ec9c
Rename dl_utils.py to dl.py
sanketverma1704 d6a7132
Remove dl_utils.py
sanketverma1704 2d2cfb1
Fix imports
sanketverma1704 326b93d
Add changes to support new gramex.yaml config.
sanketverma1704 db0b20c
Remove spaces
sanketverma1704 7c59db3
Add changes to run PyTorch and Hugging Face only when requested and f…
sanketverma1704 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| from torch.utils.data import Dataset | ||
| import torch | ||
|
|
||
|
|
||
| class SentimentDataset(Dataset): | ||
| def __init__(self, encodings, labels): | ||
| self.encodings = encodings | ||
| self.labels = labels | ||
|
|
||
| def __getitem__(self, idx): | ||
| item = {key: torch.tensor(val[idx]) for key, val in self.encodings.items()} | ||
| item['labels'] = torch.tensor(self.labels[idx]).to(torch.int64) | ||
| return item | ||
|
|
||
| def __len__(self): | ||
| return len(self.labels) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.