internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: huggingface/huggingface_hub

Issue:
[Bug] Filtering models by tags using `ModelFilter` doesn't work
_Originally reported by @thomwolf on [Slack](https://huggingface.slack.com/archives/C02V5EA0A95/p1694703597439229) (private):_

Model filtering by tags using `ModelFilter` doesn't work:

```py
>>> from huggingface_hub import list_models, ModelFilter

>>> filter = ModelFilter(author="HuggingFaceBR4", tags=["tensorboard"])
>>> models = list(list_models(filter=filter))
>>> models[0]   # <= doesn't have a "tensorboard" tag
ModelInfo: { 
  {'_id': '63ff7c00ea1782e758c69b5d',
   'author': 'HuggingFaceBR4',
   'id': 'HuggingFaceBR4/gpt2-20b',
   (...)
   'tags': ['transformers', 'gpt2', 'text-generation', 'text-generation-inference', 'region:us']}
}
```

A workaround is to use `list_models(author="HuggingFaceBR4", filter="tensorboard")` directly without `ModelFilter`. Would still be good to investigate.


Discussion:

Resolving patch:
diff --git a/src/huggingface_hub/hf_api.py b/src/huggingface_hub/hf_api.py
--- a/src/huggingface_hub/hf_api.py
+++ b/src/huggingface_hub/hf_api.py
@@ -1153,7 +1153,6 @@ def _unpack_model_filter(self, model_filter: ModelFilter):
         Unpacks a [`ModelFilter`] into something readable for `list_models`
         """
         model_str = ""
-        tags = []
 
         # Handling author
         if model_filter.author is not None:
@@ -1186,13 +1185,11 @@ def _unpack_model_filter(self, model_filter: ModelFilter):
 
         # Handling tags
         if model_filter.tags:
-            tags.extend([model_filter.tags] if isinstance(model_filter.tags, str) else model_filter.tags)
+            filter_list.extend([model_filter.tags] if isinstance(model_filter.tags, str) else model_filter.tags)
 
         query_dict: Dict[str, Any] = {}
         if model_str is not None:
             query_dict["search"] = model_str
-        if len(tags) > 0:
-            query_dict["tags"] = tags
         if isinstance(model_filter.language, list):
             filter_list.extend(model_filter.language)
         elif isinstance(model_filter.language, str):


Test patch:
diff --git a/tests/test_hf_api.py b/tests/test_hf_api.py
--- a/tests/test_hf_api.py
+++ b/tests/test_hf_api.py
@@ -1751,6 +1751,14 @@ def test_filter_models_by_language(self):
         res_en = list(self._api.list_models(filter=ModelFilter(language="en")))
         self.assertGreater(len(res_en), len(res_fr))
 
+    def test_filter_models_with_tag(self):
+        models = list(self._api.list_models(filter=ModelFilter(author="HuggingFaceBR4", tags=["tensorboard"])))
+        self.assertTrue("HuggingFaceBR4" == models[0].author)
+        self.assertTrue("tensorboard" in models[0].tags)
+
+        models = list(self._api.list_models(filter=ModelFilter(tags="dummytag")))
+        self.assertEqual(len(models), 0)
+
     def test_filter_models_with_complex_query(self):
         args = ModelSearchArguments(api=self._api)
         f = ModelFilter(
Repository: huggingface/huggingface_hub

Issue:
Make note that token from hugging face will not echo
### Describe the bug

I'm embarrassed to say I didn't realize at first that the program would not echo my token and pasted it a few times in the process. I've created a PR to add a little note stating that the token will not echo to the user as part of this issue. This will hopefully help people like me in the future not make this mistake.

### Reproduction

log in to huggingface using the cli

### Logs

_No response_

### System info

```shell
Package: huggingface-hub 0.19.4, installed using Python 3.11.6
OS: OpenSUSE MicroOS (tumbleweed distrobox)
Kernel: 6.6.6-1-default
```



Discussion:

Resolving patch:
diff --git a/src/huggingface_hub/_login.py b/src/huggingface_hub/_login.py
--- a/src/huggingface_hub/_login.py
+++ b/src/huggingface_hub/_login.py
@@ -186,7 +186,7 @@ def interpreter_login(new_session: bool = True, write_permission: bool = False)
     print("    To login, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .")
     if os.name == "nt":
         print("Token can be pasted using 'Right-Click'.")
-    token = getpass("Token: ")
+    token = getpass("Enter your token (input will not be visible): ")
     add_to_git_credential = _ask_for_confirmation_no_tui("Add token as git credential?")
 
     _login(token=token, add_to_git_credential=add_to_git_credential, write_permission=write_permission)


Test patch:
Repository: huggingface/huggingface_hub

Issue:
Warn when 403 unauthorized error + token is read-only
Might be good in `hf_raise_for_token` to let the user know that they are using a read-only token (when it's the case) and that it can explain why the action cannot be performed.


Discussion:

Resolving patch:
diff --git a/src/huggingface_hub/utils/_errors.py b/src/huggingface_hub/utils/_errors.py
--- a/src/huggingface_hub/utils/_errors.py
+++ b/src/huggingface_hub/utils/_errors.py
@@ -357,6 +357,15 @@ def hf_raise_for_status(response: Response, endpoint_name: Optional[str] = None)
             )
             raise BadRequestError(message, response=response) from e
 
+        elif response.status_code == 403:
+            message = (
+                f"\n\n{response.status_code} Forbidden: {error_message}."
+                + f"\nCannot access content at: {response.url}."
+                + "\nIf you are trying to create or update content,"
+                + "make sure you have a token with the `write` role."
+            )
+            raise HfHubHTTPError(message, response=response) from e
+
         # Convert `HTTPError` into a `HfHubHTTPError` to display request information
         # as well (request id and/or server error message)
         raise HfHubHTTPError(str(e), response=response) from e


Test patch:
diff --git a/tests/test_utils_errors.py b/tests/test_utils_errors.py
--- a/tests/test_utils_errors.py
+++ b/tests/test_utils_errors.py
@@ -49,6 +49,19 @@ def test_hf_raise_for_status_401_repo_url(self) -> None:
         self.assertEqual(context.exception.response.status_code, 401)
         self.assertIn("Request ID: 123", str(context.exception))
 
+    def test_hf_raise_for_status_403_wrong_token_scope(self) -> None:
+        response = Response()
+        response.headers = {"X-Request-Id": 123, "X-Error-Message": "specific error message"}
+        response.status_code = 403
+        response.request = PreparedRequest()
+        response.request.url = "https://huggingface.co/api/repos/create"
+        expected_message_part = "403 Forbidden: specific error message"
+        with self.assertRaisesRegex(HfHubHTTPError, expected_message_part) as context:
+            hf_raise_for_status(response)
+
+        self.assertEqual(context.exception.response.status_code, 403)
+        self.assertIn("Request ID: 123", str(context.exception))
+
     def test_hf_raise_for_status_401_not_repo_url(self) -> None:
         response = Response()
         response.headers = {"X-Request-Id": 123}
Repository: watchdogpolska/small_eod

Issue:
Tagi
Stworzenie ekranu Tagi

tabela zawiera kolumnę 
* tag (pole `name` w serializatorze)

Ekran paginowy wielkość strony 20
Ekran dostępny z menu bocznego


Discussion:

Resolving patch:
diff --git a/backend-project/small_eod/tags/serializers.py b/backend-project/small_eod/tags/serializers.py
--- a/backend-project/small_eod/tags/serializers.py
+++ b/backend-project/small_eod/tags/serializers.py
@@ -7,4 +7,5 @@ class Meta:
         model = Tag
         fields = [
             "name",
+            "id",
         ]


Test patch:
Repository: keras-team/autokeras

Issue:
load_raw_image.zip example is broken
### Bug Description
The load_raw_image example in the load_raw_image.zip under examples still contains the old naming convention:

```from autokeras.classifier import load_image_dataset```

While the current (and working) example in the github pages reads:

```from autokeras.image_supervised import load_image_dataset```

### Reproducing Steps
Steps to reproduce the behavior:
  * Step 1: Download zip and extract
  * Step 2: See for yourself

### Expected Behavior
A working example on download :-)

Might I suggest removing the code from the zip file and just placing it on git. So it can more easily be spotted and updated. Since I assume the image files will remain the same leaving them in a zip makes sense I guess.


Discussion:
I might fix this myself tomorrow if you agree with my proposed solution or provide a better suggestion.
@dietercastel Thank you so much!
You can go ahead a fix it.

Resolving patch:
diff --git a/examples/load_raw_image/load.py b/examples/load_raw_image/load.py
new file mode 100644
--- /dev/null
+++ b/examples/load_raw_image/load.py
@@ -0,0 +1,31 @@
+#To run first unzip ../load_raw_image_data.zip into ../
+# so the train and test directories reside in this directory 
+
+from autokeras.image_supervised import load_image_dataset
+from keras.datasets import mnist
+from autokeras import ImageClassifier
+
+
+def load_images():
+    x_train, y_train = load_image_dataset(csv_file_path="train/label.csv",
+                                          images_path="train")
+    print(x_train.shape)
+    print(y_train.shape)
+
+    x_test, y_test = load_image_dataset(csv_file_path="test/label.csv",
+                                        images_path="test")
+    print(x_test.shape)
+    print(y_test.shape)
+    return x_train, y_train, x_test, y_test
+
+def run():
+    x_train, y_train, x_test, y_test = load_images()
+    #After loading train and evaluate classifier.
+    clf = ImageClassifier(verbose=True, augment=False)
+    clf.fit(x_train, y_train, time_limit=12 * 60 * 60)
+    clf.final_fit(x_train, y_train, x_test, y_test, retrain=True)
+    y = clf.evaluate(x_test, y_test)
+    print(y * 100)
+
+if __name__ == '__main__':
+    run()


Test patch:
Repository: keras-team/autokeras

Issue:
"numpy.linalg.linalg.LinAlgError: N-th leading minor of the array is not positive definite" exception while training ImageClassifier
<!---
**If you are reporting a bug:**
*  Verify that your issue is not being currently addressed by other issues or pull requests.
*  Please note that Auto-Keras is only compatible with **Python 3.6**.
*  Tag the issue with the `bug report` tag.
-->

### Bug Description

When training ImageClassifier on float inputs of shape 80x92x24 on a binary classification task, this exception is thrown when AutoKeras lists all created models until this point and their respected losses and metrics. Here is a more complete log + stack trace:  http://termbin.com/gb3n

### Reproducing Steps

* Create a dataset of noise shaped 80x92x24 with ~360 or so samples
*  Respective binary labels.

In my case, some values of the dataset are quite large (they vary between 0 and 1_000_000, but I'm not sure that this is related since AutoKeras performs normalization).

* Have it train on a GTX 1070Ti or equivalent in terms of vram for about an hour (can't confirm that it's GPU-related either).
* Wait for the exception


### Expected Behavior

It should work.

### Setup Details
 - OS type and version: Ubuntu 18.04
 - Python: 3.6
 - autokeras: 0.2.14 (installed manually from git)
- all dependencies are installed as stated in requirements.txt for this release, unless for:
- tensorflow 1.10, compiled locally. 



Discussion:
@Zvezdin Thank you for the report.
I think this has been fixed in the develop branch.
Will be released soon.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -5,12 +5,12 @@
     packages=['autokeras'],  # this must be the same as the name above
     install_requires=['torch==0.4.1', 'torchvision==0.2.1', 'numpy>=1.14.5', 'keras==2.2.2', 'scikit-learn==0.19.1',
                       'tensorflow>=1.10.0', 'tqdm==4.25.0'],
-    version='0.2.17',
+    version='0.2.18',
     description='AutoML for deep learning',
     author='Haifeng Jin',
     author_email='jhfjhfj1@gmail.com',
     url='http://autokeras.com',
-    download_url='https://github.com/jhfjhfj1/autokeras/archive/0.2.17.tar.gz',
+    download_url='https://github.com/jhfjhfj1/autokeras/archive/0.2.18.tar.gz',
     keywords=['automl'],  # arbitrary keywords
     classifiers=[]
 )


Test patch:
Repository: keras-team/autokeras

Issue:
Splitting the validation dataset
<!---
**If you are reporting a bug:**
*  Verify that your issue is not being currently addressed by other issues or pull requests.
*  Please note that Auto-Keras is only compatible with **Python 3.6**.
*  Tag the issue with the `bug report` tag.
-->

### Bug Description
The split is for training and validation set is not correct.
This line should be changed.
https://github.com/jhfjhfj1/autokeras/blob/develop/autokeras/image_supervised.py#L220

### Reproducing Steps
It doesn't crash the program

### Expected Behavior
<!---
A clear and concise description of what you expected to happen.
-->
Use 10% of the dataset as the validation set.
If the validation set is larger than 5000 instances, use 5000 instances in the validation set.

### Setup Details
Any setup.

### Additional context
<!---
Add any other context about the problem here.
-->


Discussion:

Resolving patch:
diff --git a/autokeras/image/image_supervised.py b/autokeras/image/image_supervised.py
--- a/autokeras/image/image_supervised.py
+++ b/autokeras/image/image_supervised.py
@@ -158,9 +158,11 @@ def fit(self, x, y, x_test=None, y_test=None, time_limit=None):
         y = self.transform_y(y)
         if x_test is None or y_test is None:
             # Divide training data into training and testing data.
+            validation_set_size = int(len(y) * Constant.VALIDATION_SET_SIZE)
+            validation_set_size = min(validation_set_size, 500)
+            validation_set_size = max(validation_set_size, 1)
             x_train, x_test, y_train, y_test = train_test_split(x, y,
-                                                                test_size=min(Constant.VALIDATION_SET_SIZE,
-                                                                              int(len(y) * 0.2)),
+                                                                test_size=validation_set_size,
                                                                 random_state=42)
         else:
             x_train = x


Test patch:
diff --git a/tests/image/test_image_supervised.py b/tests/image/test_image_supervised.py
--- a/tests/image/test_image_supervised.py
+++ b/tests/image/test_image_supervised.py
@@ -74,7 +74,7 @@ def test_timeout_resume(_):
     # make it impossible to complete within 10sec
     Constant.MAX_MODEL_NUM = 1000
     Constant.SEARCH_MAX_ITER = 1
-    Constant.T_MIN = 0.8
+    # Constant.T_MIN = 0.8
     train_x = np.random.rand(100, 25, 25, 1)
     train_y = np.random.randint(0, 5, 100)
     test_x = np.random.rand(100, 25, 25, 1)
Repository: keras-team/autokeras

Issue:
cannot install autokeras because of package dependency confliction
### Bug Description
following package dependency is configured at setup.py
https://github.com/jhfjhfj1/autokeras/blob/master/setup.py#L6

```
install_requires=['torch==0.4.1', 'torchvision==0.2.1', 'numpy>=1.14.5', 'keras==2.2.2', 'scikit-learn==0.19.1',
                      'tensorflow>=1.10.0', 'tqdm==4.25.0'],
```

When execute `pip install autokeras`, following error is appeared.

```
keras 2.2.2 has requirement keras-applications==1.0.4, but you'll have keras-applications 1.0.6 which is incompatible.
keras 2.2.2 has requirement keras-preprocessing==1.0.2, but you'll have keras-preprocessing 1.0.5 which is incompatible.
```

It is because that tensorflow==1.11.0 is installed first and
keras-applications >= 1.0.5 and keras-preprocessing > = 1.0.3 can installed with tensorflow==1.11.0.
On the other hand, keras==2.2.2's dependency versions are keras-applications==1.0.4 and keras-preprocessing==1.0.2.

 tensorflow version should be defined as `tensorflow==1.10.0`at [setup.py L6](https://github.com/jhfjhfj1/autokeras/blob/master/setup.py#L6).

```
# before
install_requires=['torch==0.4.1', 'torchvision==0.2.1', 'numpy>=1.14.5', 'keras==2.2.2', 'scikit-learn==0.19.1',
                      'tensorflow>=1.10.0', 'tqdm==4.25.0'],

# after
install_requires=['torch==0.4.1', 'torchvision==0.2.1', 'numpy>=1.14.5', 'keras==2.2.2', 'scikit-learn==0.19.1',
                      'tensorflow==1.10.0', 'tqdm==4.25.0'],
```

### Reproducing Steps
 
Step1: curl https://gist.githubusercontent.com/chie8842/b3b9f3ea2d886bbb5aa5c903b9e42ee3/raw/e94cc375ca1265c66d4517a25a748f1e13a3de9d/Dockerfile -o Dockerfile
Step2: docker build -t autokeras -f Dockerfile .
Step3: docker run -it --rm autokeras /bin/bash
Step4: sudo pip install autokeras


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@
     name='autokeras',
     packages=['autokeras'],  # this must be the same as the name above
     install_requires=['torch==0.4.1', 'torchvision==0.2.1', 'numpy>=1.14.5', 'keras==2.2.2', 'scikit-learn==0.19.1',
-                      'tensorflow>=1.10.0', 'tqdm==4.25.0'],
+                      'tensorflow==1.10.0', 'tqdm==4.25.0'],
     version='0.2.18',
     description='AutoML for deep learning',
     author='Haifeng Jin',


Test patch:
Repository: keras-team/autokeras

Issue:
Use cutout for image data



Discussion:

Resolving patch:
diff --git a/autokeras/constant.py b/autokeras/constant.py
--- a/autokeras/constant.py
+++ b/autokeras/constant.py
@@ -2,6 +2,8 @@ class Constant:
     # Data
 
     VALIDATION_SET_SIZE = 0.08333
+    CUTOUT_HOLES = 1
+    CUTOUT_RATIO = 0.5
 
     # Searcher
 
diff --git a/autokeras/preprocessor.py b/autokeras/preprocessor.py
--- a/autokeras/preprocessor.py
+++ b/autokeras/preprocessor.py
@@ -52,6 +52,47 @@ def inverse_transform(self, data):
         return np.array(list(map(lambda x: self.int_to_label[x], np.argmax(np.array(data), axis=1))))
 
 
+class Cutout(object):
+    """Randomly mask out one or more patches from an image.
+    Args:
+        n_holes (int): Number of patches to cut out of each image.
+        length (int): The length (in pixels) of each square patch.
+    """
+
+    def __init__(self, n_holes, length):
+        self.n_holes = n_holes
+        self.length = length
+
+    def __call__(self, img):
+        """
+        Args:
+            img (Tensor): Tensor image of size (C, H, W).
+        Returns:
+            Tensor: Image with n_holes of dimension length x length cut out of it.
+        """
+        h = img.size(1)
+        w = img.size(2)
+
+        mask = np.ones((h, w), np.float32)
+
+        for n in range(self.n_holes):
+            y = np.random.randint(h)
+            x = np.random.randint(w)
+
+            y1 = np.clip(y - self.length // 2, 0, h)
+            y2 = np.clip(y + self.length // 2, 0, h)
+            x1 = np.clip(x - self.length // 2, 0, w)
+            x2 = np.clip(x + self.length // 2, 0, w)
+
+            mask[y1: y2, x1: x2] = 0.
+
+        mask = torch.from_numpy(mask)
+        mask = mask.expand_as(img)
+        img = img * mask
+
+        return img
+
+
 class DataTransformer(ABC):
     @abstractmethod
     def transform_train(self, data, targets=None, batch_size=None):
@@ -95,16 +136,17 @@ def __init__(self, data, augment=Constant.DATA_AUGMENTATION):
         self.augment = augment
 
     def transform_train(self, data, targets=None, batch_size=None):
-        if not self.augment:
-            augment_list = []
-        else:
-            augment_list = [ToPILImage(),
+        short_edge_length = min(data.shape[1], data.shape[2])
+        common_list = [Normalize(torch.Tensor(self.mean), torch.Tensor(self.std))]
+        if self.augment:
+            compose_list = [ToPILImage(),
                             RandomCrop(data.shape[1:3], padding=4),
                             RandomHorizontalFlip(),
                             ToTensor()
-                            ]
-        common_list = [Normalize(torch.Tensor(self.mean), torch.Tensor(self.std))]
-        compose_list = augment_list + common_list
+                            ] + common_list + [Cutout(n_holes=Constant.CUTOUT_HOLES,
+                                                      length=int(short_edge_length * Constant.CUTOUT_RATIO))]
+        else:
+            compose_list = common_list
 
         dataset = self._transform(compose_list, data, targets)
 


Test patch:
Repository: keras-team/autokeras

Issue:
Temp folder conflict
<!---
**If you are reporting a bug:**
*  Verify that your issue is not being currently addressed by other issues or pull requests.
*  Please note that Auto-Keras is only compatible with **Python 3.6**.
*  Tag the issue with the `bug report` tag.
-->

### Bug Description
<!---

-->
Temp folder generated will be conflict if one server has multiple users use the package.




Discussion:

Resolving patch:
diff --git a/autokeras/utils.py b/autokeras/utils.py
--- a/autokeras/utils.py
+++ b/autokeras/utils.py
@@ -12,7 +12,8 @@
 from skimage.transform import resize
 import torch
 import subprocess
-
+import string
+import random
 from autokeras.constant import Constant
 
 
@@ -86,8 +87,11 @@ def get_device():
 
 def temp_folder_generator():
     """Create and return a temporary directory with the path name '/temp_dir_name/autokeras' (E:g:- /tmp/autokeras)."""
+    chars = string.ascii_uppercase + string.digits
+    size = 6
     sys_temp = tempfile.gettempdir()
-    path = os.path.join(sys_temp, 'autokeras')
+    random_suffix = ''.join(random.choice(chars) for _ in range(size))
+    path = os.path.join(sys_temp, 'autokeras_' + random_suffix)
     ensure_dir(path)
     return path
 


Test patch:
diff --git a/tests/test_utils.py b/tests/test_utils.py
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -37,7 +37,7 @@ def get(self, key):
 def test_temp_folder_generator(_):
     clean_dir(TEST_TEMP_DIR)
     path = temp_folder_generator()
-    assert path == "tests/resources/temp/autokeras"
+    assert path.find("tests/resources/temp/autokeras") != -1
     clean_dir(TEST_TEMP_DIR)