Uh oh!
There was an error while loading. Please reload this page.
Add NameEntityRecognition and Q&A deep learning tasks. - #6760
Conversation
michaelgsharp
commented
Jul 10, 2023
Q&A currently has a runtime error I am working on resolving so the builds will fail for now. Getting the PR up so reviews can start while I finish debugging. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| namespace Microsoft.ML.TorchSharp.NasBert.Models | ||
| { | ||
| internal sealed class ModelForPrediction : NasBertModel |
There was a problem hiding this comment.
This isn't for NER. Its for SentenceSimilarity and TextClassification. How about TextModel? TextModelForPrediction? Thoughts?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| for (var i = 0; i < srcTokens.size(0); ++i) | ||
| { | ||
| var srcTokenArray = srcTokens[i].ToArray<int>(); |
There was a problem hiding this comment.
I wonder if we could use the TensorAccessor exposed by the data method and avoid this array?
There was a problem hiding this comment.
Looking into it it doesn't look like the TensorAccessor exposes enough to be able to do that. @NiklasGustafsson do you know if that is correct?
There was a problem hiding this comment.
@michaelgsharp , I'm not sure which 'that' you're referring to. TensorAccessor implements IEnumerable.
There was a problem hiding this comment.
I know the TensorAccessor has direct access to the underlying memory, but it doesn't expose the underlying memory directly, correct?
There was a problem hiding this comment.
Indexing into the accessor will access the underlying native memory directly, both reading and writing, while ToArray() will make a copy.
publicTthis[paramslong[] indices]{get{longindex=0;if(indices.Length==1){index=indices[0];validate(index);
unsafe {T*ptr=(T*)_tensor_data_ptr;returnptr[TranslateIndex(index,_tensor)];}}else{
unsafe {T*ptr=(T*)_tensor_data_ptr;returnptr[TranslateIndex(indices,_tensor)];}}}Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@## main #6760 +/- ##
==========================================
+ Coverage 68.89% 68.99% +0.10%
==========================================
Files 1216 1237 +21 Lines 250915 252836 +1921 Branches 26259 26445 +186 ==========================================
+ Hits 172857 174450 +1593 - Misses 71238 71454 +216 - Partials 6820 6932 +112
Flags with carried forward coverage won't be shown. Click here to find out more.
|
ericstj
left a comment
There was a problem hiding this comment.
Thanks for resolving the feedback around GetSubArray - I'd still like for @LittleLittleCloud, @zewditu, or @JakeRadMSFT to give a pass
This PR adds in 2 new deep learning scenarios, Name Entity Recognition and Q&A.
The main files to focus on are NerTrainer.cs and Roberta/QATrainer.cs. Most of the rest are either part of the deep learning model itself or internal implementations of things I had to copy over from runtime for them to work on netstandard.