Answer the question
In order to leave comments, you need to log in
How to rewrite the string torch.argmax(model_out[0], dim=-1) without using torch?
I don't want to load the library for the sake of two lines...
model = transformers.AutoModelForTokenClassification.from_pretrained('model').to(device)
...
with torch.no_grad():
model_out = model(**encoded)
predicted_tokens = torch.argmax(model_out[0], dim=-1)
Answer the question
In order to leave comments, you need to log in
I do not want to load the torch library - how is it? Are you using it to the fullest? Through what do you calculate the values of the model? After all, the line "with torch.no_grad()" is there for a reason.
Why did you decide to save on matches? Running time, saving memory?
Try instead of the "problematic" "torch.argmax(model_out[0], dim=-1)" to put 0 and analyze how resource usage has changed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question