



import os
from datetime import datetime as dt

from github import Github


SCREAMING_SNAKE_CASE_:Optional[int]             =						[
    """good first issue""",
    """feature request""",
    """wip""",
]




def 	__UpperCamelCase	(  )       ->  Optional[Any]:



    """simple docstring"""






    A :       Tuple          =   Github(os.environ["""GITHUB_TOKEN"""]		)
    A :       Dict          =   g.get_repo("""huggingface/accelerate"""		)
    A :       Tuple          =   repo.get_issues(state="""open"""		)

    for issue in open_issues:
        A :       Tuple          =   sorted([comment for comment in issue.get_comments()]      ,     key=lambda _lowerCAmelCase		: i.created_at      ,     reverse=_lowerCAmelCase		)
        A :       Union[str, Any]          =   comments[0] if len(_lowerCAmelCase		) > 0 else None
        A :       Dict          =   dt.utcnow()
        A :       Dict          =   (current_time - issue.updated_at).days
        A :       Optional[int]          =   (current_time - issue.created_at).days
        if (
            last_comment is not None
            and last_comment.user.login == "github-actions[bot]"
            and days_since_updated > 7
            and days_since_creation >= 30
            and not any(label.name.lower() in LABELS_TO_EXEMPT for label in issue.get_labels()		)
        ):
            # Close issue since it has been 7 days of inactivity since bot mention.
            issue.edit(state="""closed"""		)
        elif (
            days_since_updated > 23
            and days_since_creation >= 30
            and not any(label.name.lower() in LABELS_TO_EXEMPT for label in issue.get_labels()		)
        ):
            # Add stale comment
            issue.create_comment(
                """This issue has been automatically marked as stale because it has not had """
                """recent activity. If you think this still needs to be addressed """
                """please comment on this thread.\n\nPlease note that issues that do not follow the """
                """[contributing guidelines](https://github.com/huggingface/accelerate/blob/main/CONTRIBUTING.md) """
                """are likely to be ignored."""		)


if __name__ == "__main__":
     main()







from __future__ import annotations

import unittest

from transformers import is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow


if is_tf_available():
     import tensorflow as tf

     from transformers import AutoTokenizer, TFAutoModelForSeqaSeqLM






@require_tf
@require_sentencepiece
@require_tokenizers
class SCREAMING_SNAKE_CASE__     (		unittest.TestCase    ):




    '''simple docstring'''






    @slow
    def 			_lowerCAmelCase					(       self		):
        A :       Any          =   TFAutoModelForSeqaSeqLM.from_pretrained("""google/mt5-small"""		)
        A :       Dict          =   AutoTokenizer.from_pretrained("""google/mt5-small"""		)

        A :       Tuple          =   tokenizer("""Hello there""",		return_tensors="""tf"""		).input_ids
        A :       Optional[int]          =   tokenizer("""Hi I am""",		return_tensors="""tf"""		).input_ids

        A :       List[Any]          =   model(lowerCamelCase__,		labels=lowerCamelCase__		).loss
        A :       str          =   -tf.math.reduce_mean(lowerCamelCase__		).numpy()

        A :       Tuple          =   -21.22_8168
        self.assertTrue(abs(mtf_score - EXPECTED_SCORE		) < 2e-4		)


