Skip to content
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

Replace one letter import in docs #5403

Merged

Conversation

MKhalusova
Copy link
Contributor

This PR updates a code example for consistency across the docs based on feedback from this comment:

"In terms of style we usually stay away from one-letter imports like this (even if the community uses them) as they are not always known by beginners and one letter is very undescriptive. Here it wouldn't change anything to use albumentations instead of A."

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jan 3, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Member

@albertvillanova albertvillanova left a comment

Choose a reason for hiding this comment

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

Thanks for the docs fix for consistency.

Again for consistency, it would be nice to make the same fix across all the docs, e.g.

>>> import albumentations as A

@MKhalusova
Copy link
Contributor Author

Thanks for the docs fix for consistency.

Again for consistency, it would be nice to make the same fix across all the docs, e.g.

>>> import albumentations as A

Excellent point!

Copy link
Member

@albertvillanova albertvillanova left a comment

Choose a reason for hiding this comment

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

Also:

>>> import albumentations as A

@MKhalusova
Copy link
Contributor Author

@albertvillanova Should be all of them now :)

Copy link
Member

@albertvillanova albertvillanova left a comment

Choose a reason for hiding this comment

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

Great! Thanks again!

@albertvillanova albertvillanova changed the title Replaced one letter import Replace one letter import in docs Jan 3, 2023
@MKhalusova MKhalusova merged commit dee3471 into huggingface:main Jan 3, 2023
@github-actions
Copy link

github-actions bot commented Jan 3, 2023

Show benchmarks

PyArrow==6.0.0

Show updated benchmarks!

Benchmark: benchmark_array_xd.json

metric read_batch_formatted_as_numpy after write_array2d read_batch_formatted_as_numpy after write_flattened_sequence read_batch_formatted_as_numpy after write_nested_sequence read_batch_unformated after write_array2d read_batch_unformated after write_flattened_sequence read_batch_unformated after write_nested_sequence read_col_formatted_as_numpy after write_array2d read_col_formatted_as_numpy after write_flattened_sequence read_col_formatted_as_numpy after write_nested_sequence read_col_unformated after write_array2d read_col_unformated after write_flattened_sequence read_col_unformated after write_nested_sequence read_formatted_as_numpy after write_array2d read_formatted_as_numpy after write_flattened_sequence read_formatted_as_numpy after write_nested_sequence read_unformated after write_array2d read_unformated after write_flattened_sequence read_unformated after write_nested_sequence write_array2d write_flattened_sequence write_nested_sequence
new / old (diff) 0.008776 / 0.011353 (-0.002576) 0.004534 / 0.011008 (-0.006474) 0.101921 / 0.038508 (0.063413) 0.029995 / 0.023109 (0.006886) 0.307180 / 0.275898 (0.031282) 0.371001 / 0.323480 (0.047521) 0.007089 / 0.007986 (-0.000896) 0.003474 / 0.004328 (-0.000855) 0.079498 / 0.004250 (0.075248) 0.036522 / 0.037052 (-0.000531) 0.311729 / 0.258489 (0.053240) 0.349861 / 0.293841 (0.056020) 0.033815 / 0.128546 (-0.094731) 0.011435 / 0.075646 (-0.064211) 0.322924 / 0.419271 (-0.096347) 0.040981 / 0.043533 (-0.002552) 0.306174 / 0.255139 (0.051035) 0.331979 / 0.283200 (0.048780) 0.091293 / 0.141683 (-0.050389) 1.480935 / 1.452155 (0.028780) 1.522022 / 1.492716 (0.029306)

Benchmark: benchmark_getitem_100B.json

metric get_batch_of_1024_random_rows get_batch_of_1024_rows get_first_row get_last_row
new / old (diff) 0.195053 / 0.018006 (0.177047) 0.424898 / 0.000490 (0.424408) 0.003869 / 0.000200 (0.003669) 0.000075 / 0.000054 (0.000021)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.024323 / 0.037411 (-0.013088) 0.098061 / 0.014526 (0.083535) 0.105770 / 0.176557 (-0.070787) 0.145799 / 0.737135 (-0.591336) 0.109109 / 0.296338 (-0.187230)

Benchmark: benchmark_iterating.json

metric read 5000 read 50000 read_batch 50000 10 read_batch 50000 100 read_batch 50000 1000 read_formatted numpy 5000 read_formatted pandas 5000 read_formatted tensorflow 5000 read_formatted torch 5000 read_formatted_batch numpy 5000 10 read_formatted_batch numpy 5000 1000 shuffled read 5000 shuffled read 50000 shuffled read_batch 50000 10 shuffled read_batch 50000 100 shuffled read_batch 50000 1000 shuffled read_formatted numpy 5000 shuffled read_formatted_batch numpy 5000 10 shuffled read_formatted_batch numpy 5000 1000
new / old (diff) 0.420434 / 0.215209 (0.205225) 4.194781 / 2.077655 (2.117126) 2.030498 / 1.504120 (0.526378) 1.885314 / 1.541195 (0.344120) 1.996485 / 1.468490 (0.527995) 0.708540 / 4.584777 (-3.876237) 3.400694 / 3.745712 (-0.345018) 2.888704 / 5.269862 (-2.381157) 1.578100 / 4.565676 (-2.987577) 0.082150 / 0.424275 (-0.342125) 0.012277 / 0.007607 (0.004669) 0.527312 / 0.226044 (0.301268) 5.289566 / 2.268929 (3.020637) 2.369997 / 55.444624 (-53.074628) 2.040365 / 6.876477 (-4.836112) 2.298857 / 2.142072 (0.156785) 0.808446 / 4.805227 (-3.996781) 0.149355 / 6.500664 (-6.351309) 0.065993 / 0.075469 (-0.009477)

Benchmark: benchmark_map_filter.json

metric filter map fast-tokenizer batched map identity map identity batched map no-op batched map no-op batched numpy map no-op batched pandas map no-op batched pytorch map no-op batched tensorflow
new / old (diff) 1.231829 / 1.841788 (-0.609959) 13.874762 / 8.074308 (5.800454) 13.464379 / 10.191392 (3.272987) 0.151105 / 0.680424 (-0.529319) 0.028689 / 0.534201 (-0.505512) 0.398720 / 0.579283 (-0.180564) 0.402108 / 0.434364 (-0.032256) 0.463426 / 0.540337 (-0.076912) 0.541919 / 1.386936 (-0.845017)
PyArrow==latest
Show updated benchmarks!

Benchmark: benchmark_array_xd.json

metric read_batch_formatted_as_numpy after write_array2d read_batch_formatted_as_numpy after write_flattened_sequence read_batch_formatted_as_numpy after write_nested_sequence read_batch_unformated after write_array2d read_batch_unformated after write_flattened_sequence read_batch_unformated after write_nested_sequence read_col_formatted_as_numpy after write_array2d read_col_formatted_as_numpy after write_flattened_sequence read_col_formatted_as_numpy after write_nested_sequence read_col_unformated after write_array2d read_col_unformated after write_flattened_sequence read_col_unformated after write_nested_sequence read_formatted_as_numpy after write_array2d read_formatted_as_numpy after write_flattened_sequence read_formatted_as_numpy after write_nested_sequence read_unformated after write_array2d read_unformated after write_flattened_sequence read_unformated after write_nested_sequence write_array2d write_flattened_sequence write_nested_sequence
new / old (diff) 0.006979 / 0.011353 (-0.004373) 0.004723 / 0.011008 (-0.006285) 0.099172 / 0.038508 (0.060664) 0.027970 / 0.023109 (0.004861) 0.415096 / 0.275898 (0.139198) 0.455916 / 0.323480 (0.132437) 0.005950 / 0.007986 (-0.002036) 0.003423 / 0.004328 (-0.000906) 0.075512 / 0.004250 (0.071262) 0.040894 / 0.037052 (0.003842) 0.419810 / 0.258489 (0.161321) 0.461913 / 0.293841 (0.168072) 0.033014 / 0.128546 (-0.095532) 0.011613 / 0.075646 (-0.064033) 0.320983 / 0.419271 (-0.098289) 0.049902 / 0.043533 (0.006369) 0.426378 / 0.255139 (0.171239) 0.445594 / 0.283200 (0.162394) 0.098978 / 0.141683 (-0.042705) 1.485724 / 1.452155 (0.033570) 1.563978 / 1.492716 (0.071262)

Benchmark: benchmark_getitem_100B.json

metric get_batch_of_1024_random_rows get_batch_of_1024_rows get_first_row get_last_row
new / old (diff) 0.232137 / 0.018006 (0.214131) 0.432785 / 0.000490 (0.432296) 0.006173 / 0.000200 (0.005973) 0.000085 / 0.000054 (0.000031)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.024924 / 0.037411 (-0.012487) 0.102878 / 0.014526 (0.088352) 0.107976 / 0.176557 (-0.068581) 0.143581 / 0.737135 (-0.593554) 0.111644 / 0.296338 (-0.184694)

Benchmark: benchmark_iterating.json

metric read 5000 read 50000 read_batch 50000 10 read_batch 50000 100 read_batch 50000 1000 read_formatted numpy 5000 read_formatted pandas 5000 read_formatted tensorflow 5000 read_formatted torch 5000 read_formatted_batch numpy 5000 10 read_formatted_batch numpy 5000 1000 shuffled read 5000 shuffled read 50000 shuffled read_batch 50000 10 shuffled read_batch 50000 100 shuffled read_batch 50000 1000 shuffled read_formatted numpy 5000 shuffled read_formatted_batch numpy 5000 10 shuffled read_formatted_batch numpy 5000 1000
new / old (diff) 0.490902 / 0.215209 (0.275693) 4.914060 / 2.077655 (2.836405) 2.569465 / 1.504120 (1.065345) 2.346872 / 1.541195 (0.805677) 2.412047 / 1.468490 (0.943557) 0.704975 / 4.584777 (-3.879802) 3.443669 / 3.745712 (-0.302043) 3.172055 / 5.269862 (-2.097807) 1.332152 / 4.565676 (-3.233525) 0.083023 / 0.424275 (-0.341252) 0.012699 / 0.007607 (0.005092) 0.592511 / 0.226044 (0.366466) 5.916376 / 2.268929 (3.647448) 3.028472 / 55.444624 (-52.416152) 2.691159 / 6.876477 (-4.185318) 2.786132 / 2.142072 (0.644060) 0.814045 / 4.805227 (-3.991182) 0.156630 / 6.500664 (-6.344034) 0.071330 / 0.075469 (-0.004139)

Benchmark: benchmark_map_filter.json

metric filter map fast-tokenizer batched map identity map identity batched map no-op batched map no-op batched numpy map no-op batched pandas map no-op batched pytorch map no-op batched tensorflow
new / old (diff) 1.277936 / 1.841788 (-0.563852) 14.331367 / 8.074308 (6.257059) 13.685694 / 10.191392 (3.494302) 0.138915 / 0.680424 (-0.541509) 0.016844 / 0.534201 (-0.517357) 0.390307 / 0.579283 (-0.188976) 0.385207 / 0.434364 (-0.049157) 0.448128 / 0.540337 (-0.092210) 0.532609 / 1.386936 (-0.854327)

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.

3 participants