repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/xla_spawn.py | examples/pytorch/xla_spawn.py | # Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/conftest.py | examples/pytorch/conftest.py | # Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/test_accelerate_examples.py | examples/pytorch/test_accelerate_examples.py | # Copyright 2018 HuggingFace Inc..
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/continuous_batching.py | examples/pytorch/continuous_batching.py | # coding=utf-8
# Copyright 2025 The HuggingFace Inc. team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/text-generation/run_generation.py | examples/pytorch/text-generation/run_generation.py | #!/usr/bin/env python
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with t... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py | examples/pytorch/speech-recognition/run_speech_recognition_ctc.py | #!/usr/bin/env python
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | true |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py | examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py | #!/usr/bin/env python
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/speech-recognition/run_speech_recognition_ctc_adapter.py | examples/pytorch/speech-recognition/run_speech_recognition_ctc_adapter.py | #!/usr/bin/env python
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | true |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/contrastive-image-text/run_clip.py | examples/pytorch/contrastive-image-text/run_clip.py | #!/usr/bin/env python
# Copyright 2022 The HuggingFace Team All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/object-detection/run_object_detection.py | examples/pytorch/object-detection/run_object_detection.py | #!/usr/bin/env python
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/object-detection/run_object_detection_no_trainer.py | examples/pytorch/object-detection/run_object_detection_no_trainer.py | # Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/image-classification/run_image_classification_no_trainer.py | examples/pytorch/image-classification/run_image_classification_no_trainer.py | # Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/image-classification/run_image_classification.py | examples/pytorch/image-classification/run_image_classification.py | #!/usr/bin/env python
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/speech-pretraining/run_wav2vec2_pretraining_no_trainer.py | examples/pytorch/speech-pretraining/run_wav2vec2_pretraining_no_trainer.py | #!/usr/bin/env python
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/semantic-segmentation/run_semantic_segmentation_no_trainer.py | examples/pytorch/semantic-segmentation/run_semantic_segmentation_no_trainer.py | # Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/semantic-segmentation/run_semantic_segmentation.py | examples/pytorch/semantic-segmentation/run_semantic_segmentation.py | #!/usr/bin/env python
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/instance-segmentation/run_instance_segmentation.py | examples/pytorch/instance-segmentation/run_instance_segmentation.py | #!/usr/bin/env python
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/instance-segmentation/run_instance_segmentation_no_trainer.py | examples/pytorch/instance-segmentation/run_instance_segmentation_no_trainer.py | #!/usr/bin/env python
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/image-pretraining/run_mim.py | examples/pytorch/image-pretraining/run_mim.py | #!/usr/bin/env python
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/image-pretraining/run_mim_no_trainer.py | examples/pytorch/image-pretraining/run_mim_no_trainer.py | #!/usr/bin/env python
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/image-pretraining/run_mae.py | examples/pytorch/image-pretraining/run_mae.py | #!/usr/bin/env python
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/translation/run_translation_no_trainer.py | examples/pytorch/translation/run_translation_no_trainer.py | #!/usr/bin/env python
# Copyright The HuggingFace Team and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | true |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/translation/run_translation.py | examples/pytorch/translation/run_translation.py | #!/usr/bin/env python
# Copyright The HuggingFace Team and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/summarization/run_summarization_no_trainer.py | examples/pytorch/summarization/run_summarization_no_trainer.py | #!/usr/bin/env python
# Copyright The HuggingFace Team and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | true |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/summarization/run_summarization.py | examples/pytorch/summarization/run_summarization.py | #!/usr/bin/env python
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/text-classification/run_classification.py | examples/pytorch/text-classification/run_classification.py | #!/usr/bin/env python
# Copyright 2020 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/text-classification/run_glue.py | examples/pytorch/text-classification/run_glue.py | #!/usr/bin/env python
# Copyright 2020 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/text-classification/run_xnli.py | examples/pytorch/text-classification/run_xnli.py | #!/usr/bin/env python
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtai... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/text-classification/run_glue_no_trainer.py | examples/pytorch/text-classification/run_glue_no_trainer.py | # Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/token-classification/run_ner_no_trainer.py | examples/pytorch/token-classification/run_ner_no_trainer.py | #!/usr/bin/env python
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | true |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/token-classification/run_ner.py | examples/pytorch/token-classification/run_ner.py | #!/usr/bin/env python
# Copyright 2020 The HuggingFace Team All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/multiple-choice/run_swag.py | examples/pytorch/multiple-choice/run_swag.py | #!/usr/bin/env python
# Copyright The HuggingFace Team and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/multiple-choice/run_swag_no_trainer.py | examples/pytorch/multiple-choice/run_swag_no_trainer.py | #!/usr/bin/env python
# Copyright The HuggingFace Team and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/question-answering/trainer_seq2seq_qa.py | examples/pytorch/question-answering/trainer_seq2seq_qa.py | # Copyright 2021 The HuggingFace Team All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/question-answering/run_seq2seq_qa.py | examples/pytorch/question-answering/run_seq2seq_qa.py | #!/usr/bin/env python
# Copyright 2021 The HuggingFace Team All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/question-answering/trainer_qa.py | examples/pytorch/question-answering/trainer_qa.py | # Copyright 2020 The HuggingFace Team All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/question-answering/run_qa_beam_search_no_trainer.py | examples/pytorch/question-answering/run_qa_beam_search_no_trainer.py | #!/usr/bin/env python
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | true |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/question-answering/run_qa_no_trainer.py | examples/pytorch/question-answering/run_qa_no_trainer.py | #!/usr/bin/env python
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | true |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/question-answering/run_qa_beam_search.py | examples/pytorch/question-answering/run_qa_beam_search.py | #!/usr/bin/env python
# Copyright 2020 The HuggingFace Team All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | true |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/question-answering/run_qa.py | examples/pytorch/question-answering/run_qa.py | #!/usr/bin/env python
# Copyright 2020 The HuggingFace Team All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/question-answering/utils_qa.py | examples/pytorch/question-answering/utils_qa.py | # Copyright 2020 The HuggingFace Team All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/language-modeling/run_plm.py | examples/pytorch/language-modeling/run_plm.py | #!/usr/bin/env python
# Copyright 2020 The HuggingFace Team All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/language-modeling/run_fim_no_trainer.py | examples/pytorch/language-modeling/run_fim_no_trainer.py | #!/usr/bin/env python
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | true |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/language-modeling/run_mlm_no_trainer.py | examples/pytorch/language-modeling/run_mlm_no_trainer.py | #!/usr/bin/env python
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | true |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/language-modeling/run_mlm.py | examples/pytorch/language-modeling/run_mlm.py | #!/usr/bin/env python
# Copyright 2020 The HuggingFace Team All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/language-modeling/run_clm_no_trainer.py | examples/pytorch/language-modeling/run_clm_no_trainer.py | #!/usr/bin/env python
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/language-modeling/run_fim.py | examples/pytorch/language-modeling/run_fim.py | #!/usr/bin/env python
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | true |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/language-modeling/run_clm.py | examples/pytorch/language-modeling/run_clm.py | #!/usr/bin/env python
# Copyright 2020 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/examples/pytorch/audio-classification/run_audio_classification.py | examples/pytorch/audio-classification/run_audio_classification.py | #!/usr/bin/env python
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/templates/adding_a_missing_tokenization_test/cookiecutter-template-{{cookiecutter.modelname}}/test_tokenization_{{cookiecutter.lowercase_modelname}}.py | templates/adding_a_missing_tokenization_test/cookiecutter-template-{{cookiecutter.modelname}}/test_tokenization_{{cookiecutter.lowercase_modelname}}.py | # coding=utf-8
# Copyright 2022 {{cookiecutter.authors}}. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/templates/adding_a_new_example_script/{{cookiecutter.directory_name}}/run_{{cookiecutter.example_shortcut}}.py | templates/adding_a_new_example_script/{{cookiecutter.directory_name}}/run_{{cookiecutter.example_shortcut}}.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2022 {{cookiecutter.authors}} and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | true |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/benchmark_v2/run_benchmarks.py | benchmark_v2/run_benchmarks.py | #!/usr/bin/env python3
# Copyright 2025 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/benchmark_v2/framework/benchmark_config.py | benchmark_v2/framework/benchmark_config.py | import hashlib
import itertools
import json
import logging
from functools import lru_cache
from typing import Any
from transformers.generation.configuration_utils import CompileConfig
from transformers.utils.import_utils import is_flash_attn_2_available, is_kernels_available
KERNELIZATION_AVAILABLE = False
try:
... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/benchmark_v2/framework/hardware_metrics.py | benchmark_v2/framework/hardware_metrics.py | import json
import logging
import subprocess
import sys
import threading
import time
from dataclasses import dataclass
from enum import Enum
from logging import Logger
import gpustat
import psutil
import torch
# Data class to hold the hardware information
def get_device_name_and_memory_total() -> tuple[str, float]:
... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/benchmark_v2/framework/data_classes.py | benchmark_v2/framework/data_classes.py | from dataclasses import dataclass
from datetime import datetime, timezone
from typing import Any
import numpy as np
from .hardware_metrics import GPURawMetrics, HardwareInfo
def compute_basic_statistics(measurements: list[float]) -> dict[str, float]:
return {
"avg": np.mean(measurements) if measurements... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/benchmark_v2/framework/benchmark_runner.py | benchmark_v2/framework/benchmark_runner.py | import gc
import json
import logging
import os
import pathlib
import re
import tempfile
import time
from datetime import datetime
from queue import Queue
from typing import Any
import torch
from datasets import Dataset
from huggingface_hub import HfApi
from tqdm import trange
from transformers import (
AutoModelF... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/.circleci/create_circleci_config.py | .circleci/create_circleci_config.py | # coding=utf-8
# Copyright 2022 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
huggingface/transformers | https://github.com/huggingface/transformers/blob/a7f29523361b2cc12e51c1f5133d95f122f6f45c/.circleci/parse_test_outputs.py | .circleci/parse_test_outputs.py | import argparse
import re
def parse_pytest_output(file_path):
skipped_tests = {}
skipped_count = 0
with open(file_path, 'r') as file:
for line in file:
match = re.match(r'^SKIPPED \[(\d+)\] (tests/.*): (.*)$', line)
if match:
skipped_count += 1
... | python | Apache-2.0 | a7f29523361b2cc12e51c1f5133d95f122f6f45c | 2026-01-04T14:38:15.407064Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/bin/srv.py | bin/srv.py | #!/usr/bin/env python
#
# Serving cheat.sh with `gevent`
#
from gevent.monkey import patch_all
from gevent.pywsgi import WSGIServer
patch_all()
import os
import sys
from app import app, CONFIG
if "--debug" in sys.argv:
# Not all debug mode features are available under `gevent`
# https://github.com/pallets... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/bin/clean_cache.py | bin/clean_cache.py | import sys
import redis
REDIS = redis.Redis(host="localhost", port=6379, db=0)
for key in sys.argv[1:]:
REDIS.delete(key)
| python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/bin/app.py | bin/app.py | #!/usr/bin/env python
# vim: set encoding=utf-8
# pylint: disable=wrong-import-position,wrong-import-order
"""
Main server program.
Configuration parameters:
path.internal.malformed
path.internal.static
path.internal.templates
path.log.main
path.log.queries
"""
from __future__ import print_funct... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/bin/release.py | bin/release.py | #!/usr/bin/env python
from __future__ import print_function
from datetime import datetime
import os
from os import path
import re
import shutil
import subprocess
from subprocess import Popen
import sys
SHARE_DIR = path.join(path.dirname(__file__), "../share/")
def run(args):
return Popen(args, stdout=sys.stdou... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/search.py | lib/search.py | """
Very naive search implementation. Just a placeholder.
Exports:
find_answer_by_keyword()
It should be implemented on the adapter basis:
1. adapter.search(keyword) returns list of matching answers
* maybe with some initial weight
2. ranking is done
3. sorted results are returned
4. eag... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/buttons.py | lib/buttons.py | TWITTER_BUTTON = """
<a href="https://twitter.com/igor_chubin" class="twitter-follow-button" data-show-count="false" data-button="grey">Follow @igor_chubin</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/post.py | lib/post.py | """
POST requests processing.
Currently used only for new cheat sheets submission.
Configuration parameters:
path.spool
"""
import string
import os
import random
from config import CONFIG
def _save_cheatsheet(topic_name, cheatsheet):
"""
Save posted cheat sheet `cheatsheet` with `topic_name`
in the... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/limits.py | lib/limits.py | """
Connection limitation.
Number of connections from one IP is limited.
We have nothing against scripting and automated queries.
Even the opposite, we encourage them. But there are some
connection limits that even we can't handle.
Currently the limits are quite restrictive, but they will be relaxed
in the future.
Us... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/languages_data.py | lib/languages_data.py | """
Programming languages information.
Will be (probably) moved to a separate file/directory
from the project tree.
"""
import pygments.lexers
LEXER = {
"assembly": pygments.lexers.NasmLexer,
"awk": pygments.lexers.AwkLexer,
"bash": pygments.lexers.BashLexer,
"basic": pygments.lexers.QBasicLexer,
... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/cheat_wrapper_test.py | lib/cheat_wrapper_test.py | from cheat_wrapper import _add_section_name
unchanged = """
python/:list
ls
+
g++
g/+
clang++
btrfs~volume
:intro
:cht.sh
python/copy+file
python/rosetta/:list
emacs:go-mode/:list
g++g++
"""
split = """
python copy file
python/copy file
python file
python/file
python+file
python/file
g++ -O1
g++/-O1
"""
def tes... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/standalone.py | lib/standalone.py | """
Standalone wrapper for the cheat.sh server.
"""
from __future__ import print_function
import sys
import textwrap
try:
import urlparse
except ModuleNotFoundError:
import urllib.parse as urlparse
import config
config.CONFIG["cache.type"] = "none"
import cheat_wrapper
import options
def show_usage():
... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/config.py | lib/config.py | """
Global configuration of the project.
All configurable parameters are stored in the global variable CONFIG,
the only variable which is exported from the module.
Default values of all configuration parameters are specified
in the `_CONFIG` dictionary. Those parameters can be overridden
by three means:
* config ... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/fetch.py | lib/fetch.py | """
Repositories fetch and update
This module makes real network and OS interaction,
and the adapters only say how exctly this interaction
should be done.
Configuration parameters:
* path.log.fetch
"""
from __future__ import print_function
import sys
import logging
import os
import subprocess
import textwrap
... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/globals.py | lib/globals.py | """
Global functions that our used everywhere in the project.
Please, no global variables here.
For the configuration related things see `config.py`
"""
from __future__ import print_function
import sys
import logging
def fatal(text):
"""
Fatal error function.
The function is being used in the standalon... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/cache.py | lib/cache.py | """
Cache implementation.
Currently only two types of cache are allowed:
* "none" cache switched off
* "redis" use redis for cache
Configuration parameters:
cache.type = redis | none
cache.redis.db
cache.redis.host
cache.redis.port
"""
import os
import json
from config import CONFIG
_RE... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/routing.py | lib/routing.py | """
Queries routing and caching.
Exports:
get_topics_list()
get_answers()
"""
import random
import re
from typing import Any, Dict, List
import cache
import adapter.cheat_sheets
import adapter.cmd
import adapter.internal
import adapter.latenz
import adapter.learnxiny
import adapter.question
import adapter.r... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/stateful_queries.py | lib/stateful_queries.py | """
Support for the stateful queries
"""
import cache
def save_query(client_id, query):
"""
Save the last query `query` for the client `client_id`
"""
cache.put("l:%s" % client_id, query)
def last_query(client_id):
"""
Return the last query for the client `client_id`
"""
return cach... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/postprocessing.py | lib/postprocessing.py | import search
import fmt.comments
def postprocess(answer, keyword, options, request_options=None):
answer = _answer_add_comments(answer, request_options=request_options)
answer = _answer_filter_by_keyword(
answer, keyword, options, request_options=request_options
)
return answer
def _answer_... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/cheat_wrapper.py | lib/cheat_wrapper.py | """
Main cheat.sh wrapper.
Parse the query, get answers from getters (using get_answer),
visualize it using frontends and return the result.
Exports:
cheat_wrapper()
"""
import re
import json
from routing import get_answers, get_topics_list
from search import find_answers_by_keyword
from languages_data import L... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/options.py | lib/options.py | """
Parse query arguments.
"""
def parse_args(args):
"""
Parse arguments and options.
Replace short options with their long counterparts.
"""
result = {
"add_comments": True,
}
query = ""
newargs = {}
for key, val in args.items():
if val == "" or val == [] or val =... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/panela/panela_colors.py | lib/panela/panela_colors.py | # vim: encoding=utf-8
import os
import sys
import colored
import itertools
from globals import MYDIR
"""
After panela will be ready for it, it will be split out in a separate project,
that will be used for all chubin's console services.
There are several features that not yet implemented (see ___doc___ in Panela)
T... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/panela/colors.py | lib/panela/colors.py | import os
import json
COLORS_JSON = os.path.join(os.path.dirname(os.path.abspath(__file__)), "colors.json")
COLOR_TABLE = json.loads(open(COLORS_JSON, "r").read())
VALID_COLORS = [x["hexString"] for x in COLOR_TABLE]
HEX_TO_ANSI = {x["hexString"]: x["colorId"] for x in COLOR_TABLE}
def rgb_from_str(s):
# s start... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/fmt/markdown.py | lib/fmt/markdown.py | """
Markdown support.
Exports:
format_text(text, config=None, highlighter=None):
Uses external pygments formatters for highlighting (passed as an argument).
"""
import re
import ansiwrap
import colored
def format_text(text, config=None, highlighter=None):
"""
Renders `text` according to markdown rules.... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/fmt/comments.py | lib/fmt/comments.py | """
Extract text from the text-code stream and comment it.
Supports three modes of normalization and commenting:
1. Don't add any comments
2. Add comments
3. Remove text, leave code only
Since several operations are quite expensive,
it actively uses caching.
Exported functions:
beautify(text, lang,... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/fmt/internal.py | lib/fmt/internal.py | """
Colorize internal cheat sheets.
Will be merged with panela later.
"""
import re
from colorama import Fore, Back, Style
import colored
PALETTES = {
0: {
1: Fore.WHITE,
2: Style.DIM,
},
1: {
1: Fore.CYAN,
2: Fore.GREEN,
3: colored.fg("orange_3"),
4: Style... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/fmt/__init__.py | lib/fmt/__init__.py | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false | |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/frontend/html.py | lib/frontend/html.py | """
Configuration parameters:
path.internal.ansi2html
"""
import sys
import os
import re
from subprocess import Popen, PIPE
MYDIR = os.path.abspath(os.path.join(__file__, "..", ".."))
sys.path.append("%s/lib/" % MYDIR)
# pylint: disable=wrong-import-position
from config import CONFIG
from globals import error
... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/frontend/__init__.py | lib/frontend/__init__.py | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false | |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/frontend/ansi.py | lib/frontend/ansi.py | """
ANSI frontend.
Exports:
visualize(answer_data, request_options)
Format:
answer_data = {
'answers': '...',}
answers = [answer,...]
answer = {
'topic': '...',
'topic_type': '...',
'answer': '...',
'format': 'ansi|code|markdown|text...',
... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/adapter/cmd.py | lib/adapter/cmd.py | """ """
# pylint: disable=unused-argument,abstract-method
import os.path
import re
from subprocess import Popen, PIPE
from .adapter import Adapter
def _get_abspath(path):
"""Find absolute path of the specified `path`
according to its
"""
if path.startswith("/"):
return path
import __m... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/adapter/learnxiny.py | lib/adapter/learnxiny.py | """
Adapters for the cheat sheets from the Learn X in Y project
Configuration parameters:
log.level
"""
# pylint: disable=relative-import
from __future__ import print_function
import os
import re
from config import CONFIG
from .git_adapter import GitRepositoryAdapter
class LearnXinY(GitRepositoryAdapter):
... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/adapter/common.py | lib/adapter/common.py | class Adapter(object):
pass
class cheatAdapter(Adapter):
pass
| python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/adapter/cheat_cheat.py | lib/adapter/cheat_cheat.py | """
Adapter for https://github.com/cheat/cheat
Cheatsheets are located in `cheat/cheatsheets/`
Each cheat sheet is a separate file without extension
"""
# pylint: disable=relative-import,abstract-method
from .git_adapter import GitRepositoryAdapter
class Cheat(GitRepositoryAdapter):
"""
cheat/cheat adapter... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/adapter/upstream.py | lib/adapter/upstream.py | """
Adapter for an external cheat sheets service (i.e. for cheat.sh)
Configuration parameters:
upstream.url
upstream.timeout
"""
# pylint: disable=relative-import
import textwrap
import requests
from config import CONFIG
from .adapter import Adapter
def _are_you_offline():
return textwrap.dedent(
... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/adapter/latenz.py | lib/adapter/latenz.py | """
Adapter for the curlable latencies numbers (chubin/late.nz)
This module can be an example of a adapter for a python project.
The adapter exposes one page ("latencies") and several its aliases
("latencies", "late.nz", "latency")
"""
# pylint: disable=relative-import
import sys
import os
from .git_adapter import G... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/adapter/rosetta.py | lib/adapter/rosetta.py | """
Implementation of RosettaCode Adapter.
Exports:
Rosetta(GitRepositoryAdapter)
"""
# pylint: disable=relative-import
import os
import glob
import yaml
from .git_adapter import GitRepositoryAdapter
from .cheat_sheets import CheatSheets
class Rosetta(GitRepositoryAdapter):
"""
Adapter for RosettaCod... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/adapter/internal.py | lib/adapter/internal.py | """
Configuration parameters:
frontend.styles
path.internal.pages
"""
import sys
import os
import collections
try:
from rapidfuzz import process, fuzz
_USING_FUZZYWUZZY = False
except ImportError:
from fuzzywuzzy import process, fuzz
_USING_FUZZYWUZZY = True
from config import CONFIG
from ... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/adapter/__init__.py | lib/adapter/__init__.py | """
Import all adapters from the current directory
and make them available for import as
adapter_module.AdapterName
"""
# pylint: disable=wildcard-import,relative-import
from os.path import dirname, basename, isfile, join
import glob
__all__ = [
basename(f)[:-3]
for f in glob.glob(join(dirname(__file__),... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/adapter/git_adapter.py | lib/adapter/git_adapter.py | """
Implementation of `GitRepositoryAdapter`, adapter that is used to handle git repositories
"""
import glob
import os
from .adapter import Adapter # pylint: disable=relative-import
def _get_filenames(path):
return [os.path.split(topic)[1] for topic in glob.glob(path)]
class RepositoryAdapter(Adapter):
... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/adapter/tldr.py | lib/adapter/tldr.py | """
Adapter for https://github.com/cheat/cheat
Cheatsheets are located in `pages/*/`
Each cheat sheet is a separate file with extension .md
The pages are formatted with a markdown dialect
"""
# pylint: disable=relative-import,abstract-method
import re
import os
from .git_adapter import GitRepositoryAdapter
class... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/adapter/question.py | lib/adapter/question.py | """
Configuration parameters:
path.internal.bin.upstream
"""
# pylint: disable=relative-import
from __future__ import print_function
import os
import re
from subprocess import Popen, PIPE
from polyglot.detect import Detector
from polyglot.detect.base import UnknownLanguage
from config import CONFIG
from langu... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
chubin/cheat.sh | https://github.com/chubin/cheat.sh/blob/031a5d3887f035aaa3bf1a3f83dff4fde2aac53d/lib/adapter/adapter.py | lib/adapter/adapter.py | """
`Adapter`, base class of the adapters.
Configuration parameters:
path.repositories
"""
import abc
import os
from six import with_metaclass
from config import CONFIG
class AdapterMC(type):
"""
Adapter Metaclass.
Defines string representation of adapters
"""
def __repr__(cls):
if... | python | MIT | 031a5d3887f035aaa3bf1a3f83dff4fde2aac53d | 2026-01-04T14:40:43.746039Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.