Fail to create datasets from a generator when using Google Big Query
COLLABORATOR
`from_generator` expects a generator function, not a generator object, so this should work:
```python
from datasets import Dataset
from google.cloud import bigquery

client = bigquery.Client()

def gen()
    # Perform a query.
    QUERY = (
        'SELECT name FROM `bigquery-public-data.usa_names.usa_1910_2013` '
         'WHERE state = "TX" '
         'LIMIT 100')
     query_job = client.query(QUERY)  # API request
     yield from query_job.result()  # Waits for query to finish

ds = Dataset.from_generator(rows)

for r in ds:
    print(r)
```
2023-04-14T15:59:36Z
https://github.com/huggingface/datasets/issues/5750#issuecomment-1508882496
https://api.github.com/repos/huggingface/datasets/issues/5750
IC_kwDODunzps5Z77hA
https://api.github.com/repos/huggingface/datasets/issues/comments/1508882496/reactions
2023-04-14T15:59:36Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1508882496
https://avatars.githubusercontent.com/u/47462742?v=4
https://api.github.com/users/mariosasko/events{/privacy}
https://api.github.com/users/mariosasko/followers
https://api.github.com/users/mariosasko/following{/other_user}
https://api.github.com/users/mariosasko/gists{/gist_id}
https://github.com/mariosasko
mariosasko
MDQ6VXNlcjQ3NDYyNzQy
https://api.github.com/users/mariosasko/orgs
https://api.github.com/users/mariosasko/received_events
https://api.github.com/users/mariosasko/repos
https://api.github.com/users/mariosasko/starred{/owner}{/repo}
https://api.github.com/users/mariosasko/subscriptions
User
https://api.github.com/users/mariosasko
public
NONE
@mariosasko your code was incomplete, so I tried to fix it:

```py
from datasets import Dataset
from google.cloud import bigquery

client = bigquery.Client()

def gen():
    # Perform a query.
    QUERY = (
        'SELECT name FROM `bigquery-public-data.usa_names.usa_1910_2013` '
         'WHERE state = "TX" '
         'LIMIT 100')
    query_job = client.query(QUERY)  # API request
    yield from query_job.result()  # Waits for query to finish

ds = Dataset.from_generator(gen)

for r in ds:
    print(r)
```

The error is also present in this case:

```
_pickle.PicklingError: Pickling client objects is explicitly not supported.
Clients have non-trivial state that is local and unpickleable.
```

I think it doesn't matter if the generator is an object or a function. The problem is that the generator is referencing an object that is not pickable (the client in this case). 
2023-04-14T16:06:37Z
https://github.com/huggingface/datasets/issues/5750#issuecomment-1508894366
https://api.github.com/repos/huggingface/datasets/issues/5750
IC_kwDODunzps5Z7-ae
https://api.github.com/repos/huggingface/datasets/issues/comments/1508894366/reactions
2023-04-14T16:06:37Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1508894366
https://avatars.githubusercontent.com/u/895720?v=4
https://api.github.com/users/ivanprado/events{/privacy}
https://api.github.com/users/ivanprado/followers
https://api.github.com/users/ivanprado/following{/other_user}
https://api.github.com/users/ivanprado/gists{/gist_id}
https://github.com/ivanprado
ivanprado
MDQ6VXNlcjg5NTcyMA==
https://api.github.com/users/ivanprado/orgs
https://api.github.com/users/ivanprado/received_events
https://api.github.com/users/ivanprado/repos
https://api.github.com/users/ivanprado/starred{/owner}{/repo}
https://api.github.com/users/ivanprado/subscriptions
User
https://api.github.com/users/ivanprado
public
COLLABORATOR
It does matter: this function expects a generator function, as stated in the docs.

This should work:
```python
from datasets import Dataset
from google.cloud import bigquery

def gen():
    client = bigquery.Client()
    # Perform a query.
    QUERY = (
        'SELECT name FROM `bigquery-public-data.usa_names.usa_1910_2013` '
         'WHERE state = "TX" '
         'LIMIT 100')
    query_job = client.query(QUERY)  # API request
    yield from query_job.result()  # Waits for query to finish

ds = Dataset.from_generator(gen)

for r in ds:
    print(r)
```

We could allow passing non-picklable objects and use a random hash for the generated arrow file. In that case, the caching mechanism would not work, meaning repeated calls with the same set of arguments would generate new datasets instead of reusing the cached version, but this behavior is still better than raising an error.
2023-04-14T17:49:51Z
https://github.com/huggingface/datasets/issues/5750#issuecomment-1509018127
https://api.github.com/repos/huggingface/datasets/issues/5750
IC_kwDODunzps5Z8coP
https://api.github.com/repos/huggingface/datasets/issues/comments/1509018127/reactions
2023-04-14T17:49:51Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1509018127
https://avatars.githubusercontent.com/u/47462742?v=4
https://api.github.com/users/mariosasko/events{/privacy}
https://api.github.com/users/mariosasko/followers
https://api.github.com/users/mariosasko/following{/other_user}
https://api.github.com/users/mariosasko/gists{/gist_id}
https://github.com/mariosasko
mariosasko
MDQ6VXNlcjQ3NDYyNzQy
https://api.github.com/users/mariosasko/orgs
https://api.github.com/users/mariosasko/received_events
https://api.github.com/users/mariosasko/repos
https://api.github.com/users/mariosasko/starred{/owner}{/repo}
https://api.github.com/users/mariosasko/subscriptions
User
https://api.github.com/users/mariosasko
public
NONE
Thank you @mariosasko . Your last code is working indeed. Curiously, the important detail here was to wrap the client instantiation within the generator itself. If the line `client = bigquery.Client()` is moved outside, then the error is back.

I see now also your point in regard to the generator being a generator function. We can close the issue if you want.
2023-04-17T08:34:45Z
https://github.com/huggingface/datasets/issues/5750#issuecomment-1510929909
https://api.github.com/repos/huggingface/datasets/issues/5750
IC_kwDODunzps5aDvX1
https://api.github.com/repos/huggingface/datasets/issues/comments/1510929909/reactions
2023-04-17T08:34:45Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1510929909
https://avatars.githubusercontent.com/u/895720?v=4
https://api.github.com/users/ivanprado/events{/privacy}
https://api.github.com/users/ivanprado/followers
https://api.github.com/users/ivanprado/following{/other_user}
https://api.github.com/users/ivanprado/gists{/gist_id}
https://github.com/ivanprado
ivanprado
MDQ6VXNlcjg5NTcyMA==
https://api.github.com/users/ivanprado/orgs
https://api.github.com/users/ivanprado/received_events
https://api.github.com/users/ivanprado/repos
https://api.github.com/users/ivanprado/starred{/owner}{/repo}
https://api.github.com/users/ivanprado/subscriptions
User
https://api.github.com/users/ivanprado
public
### Describe the bug

Creating a dataset from a generator using `Dataset.from_generator()` fails if the generator is the [Google Big Query Python client](https://cloud.google.com/python/docs/reference/bigquery/latest). The problem is that the Big Query client is not pickable. And the function `create_config_id` tries to get a hash of the generator by pickling it. So the following error is generated:

```
_pickle.PicklingError: Pickling client objects is explicitly not supported.
Clients have non-trivial state that is local and unpickleable.
```


### Steps to reproduce the bug

1. Install the big query client and datasets `pip install google-cloud-bigquery datasets`
2. Run the following code:

```py
from datasets import Dataset
from google.cloud import bigquery

client = bigquery.Client()

# Perform a query.
QUERY = (
    'SELECT name FROM `bigquery-public-data.usa_names.usa_1910_2013` '
    'WHERE state = "TX" '
    'LIMIT 100')
query_job = client.query(QUERY)  # API request
rows = query_job.result()  # Waits for query to finish

ds = Dataset.from_generator(rows)

for r in ds:
    print(r)
```

### Expected behavior

Two options:
1. Ignore the pickle errors when computing the hash
2. Provide a scape hutch so that we can avoid calculating the hash for the generator. For example, allowing to provide a hash from the user. 

### Environment info

python 3.9
google-cloud-bigquery         3.9.0
datasets                      2.11.0
