Skip to content

Add input tokens field#117

Merged
vhaldemar merged 9 commits intoyandex-cloud:masterfrom
GBocharov:add-input_tokens-field
Jul 9, 2025
Merged

Add input tokens field#117
vhaldemar merged 9 commits intoyandex-cloud:masterfrom
GBocharov:add-input_tokens-field

Conversation

@GBocharov
Copy link
Copy Markdown
Collaborator

Without examples yet

class TextClassifiersModelResultBase(BaseResult, Sequence, Generic[TextClassificationResponseT]):
predictions: tuple[TextClassificationLabel, ...]
model_version: str
#: doc Number of input tokens provided to the model.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#: doc was just an example

"doc" word is unnecessary

for prediction in result:
print(prediction)

print(f'input_tokens= {result.input_tokens}')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer "f{result.input_tokens=}" usually, but it is okay


async def main() -> None:
sdk = AsyncYCloudML(folder_id='b1ghsjum2v37c2un8h64')
sdk = AsyncYCloudML(folder_id='yc.fomo.storage.prod.service')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like this folder_id in the code.
I also don't like old version(

It is okay for now, but I will bump the related ticket

assert len(result) == len(result.predictions) == 2
assert result[0]['label'] == result[0].label == 'foo'
assert result[0].confidence < 0.5
assert result[0].confidence > 0.5
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kinda strange - why confidence changed it polarity?

@vhaldemar vhaldemar merged commit 8ad9b9b into yandex-cloud:master Jul 9, 2025
11 checks passed
GBocharov added a commit that referenced this pull request Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants