-
Notifications
You must be signed in to change notification settings - Fork 100
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
Attempt at progressively feeding the Session to bypass type checking in #69
base: master
Are you sure you want to change the base?
Attempt at progressively feeding the Session to bypass type checking in #69
Conversation
…rom a tensor This is some prep work for string output types and tensor types that vary across the model outputs. For now, the supported types are just the basic numeric types. Since strings have to be copied out of a tensor, it only makes sense to have `String` be an output type, not `str`, hence the new type so that we can have more input types supported than output types.
Outputs aren't all the same type for a single model, so this allows extracting different types per tensor.
This approach allocates owned Strings for each element, which works, but stresses the allocator, and incurs unnecessary copying. Part of the complication stems from the limitation that in Rust, a field can't be a reference to another field in the same struct. This means that having a Vec<u8> of copied data, referred to by a Vec<&str>, which is then referred to by an ArrayView, requires a sequence of 3 structs to express. Building a Vec<String> gets rid of the references, but also loses the efficiency of 1 allocation with strs pointing into it.
Codecov Report
@@ Coverage Diff @@
## master #69 +/- ##
===========================================
+ Coverage 14.58% 44.66% +30.08%
===========================================
Files 18 19 +1
Lines 960 1097 +137
===========================================
+ Hits 140 490 +350
+ Misses 820 607 -213
Continue to review full report at Codecov.
|
Sorry for the delay; I've been busy with other projects but I'll be able to take a look soon (famous last words...). |
@marshallpierce I would love some feedback about this approach for differently typed tensors for inputs.
Just as a reminder,the inputs of the graph I have contain differently shaped and differently typed arrays
(input_ids, i64, [x, y]) , (past_key_values, f32, (x, y, z, m))
The session starts keeping the pointers, which means I have to leak the pointer from the
feed
function, and drop them after running the session.The good thing with this approach is that
run
can keep backward compatibility and still enable more advanced usages (and no super complex types and extractions.