Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added translation of 3 files as mentioned in issue #1772

Merged
merged 34 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3559892
Added translation of 3 files as mentioned in issue
aneeshd27 Oct 21, 2023
30adda6
Create in_translation.md
aneeshd27 Oct 23, 2023
ed322de
Create README_hi.md
aneeshd27 Oct 23, 2023
497e5b7
Update build_documentation.yaml for Hindi(hi)
aneeshd27 Oct 23, 2023
10f8b38
Update build_pr_documentation.yaml
aneeshd27 Oct 23, 2023
1c6383b
Update build_documentation.yaml
aneeshd27 Oct 23, 2023
89a34ee
Update index.md
aneeshd27 Oct 23, 2023
95fa2ca
Update installation.md in hi
aneeshd27 Oct 23, 2023
be59697
Update quick-start.md
aneeshd27 Oct 23, 2023
8bb5292
Delete docs/source/hi/package_reference directory
aneeshd27 Oct 23, 2023
b522212
Merge branch 'main' into aneeshd27-translation
aneeshd27 Oct 23, 2023
c8bd5ef
Delete docs/source/hi/_redirects.yml
aneeshd27 Oct 24, 2023
b5adf5d
Update _toctree.yml
aneeshd27 Oct 24, 2023
f7fdbde
Update README_hi.md
aneeshd27 Oct 24, 2023
729241f
Update README.md
aneeshd27 Oct 24, 2023
07b7857
Update README.md
aneeshd27 Oct 24, 2023
cabfe97
Update README.md
aneeshd27 Oct 24, 2023
1e4d45b
Update README_de.md
aneeshd27 Oct 24, 2023
fe9952d
Update README_de.md
aneeshd27 Oct 24, 2023
92ef359
Update README_ko.md
aneeshd27 Oct 24, 2023
4c72fe3
Update README_hi.md
aneeshd27 Oct 24, 2023
2d87b97
Update README_hi.md
aneeshd27 Oct 24, 2023
3e82f5b
Update _toctree.yml
aneeshd27 Oct 25, 2023
9adb7cd
Update README.md
aneeshd27 Oct 25, 2023
8deab90
Update README_de.md
aneeshd27 Oct 25, 2023
74c7017
Update README_ko.md
aneeshd27 Oct 25, 2023
5e01875
Update README_hi.md
aneeshd27 Oct 25, 2023
732f33e
Merge branch 'main' into aneeshd27-translation
aneeshd27 Oct 25, 2023
c4ebc34
Update docs/source/hi/_toctree.yml
Wauplin Oct 26, 2023
f784de3
Update README_hi.md
Wauplin Oct 26, 2023
6dc8ddb
Delete docs/source/hi/concepts directory
aneeshd27 Oct 26, 2023
803cafa
Delete docs/source/hi/in_translation.md
aneeshd27 Oct 26, 2023
96bd75d
Delete docs/source/hi/guides directory
aneeshd27 Oct 26, 2023
38a95dc
Merge branch 'main' into aneeshd27-translation
aneeshd27 Oct 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/source/hi/_redirects.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Move "how-to" pages to the guides/ folder
how-to-cache: guides/manage-cache
how-to-discussions-and-pull-requests: guides/community
how-to-downstream: guides/download
how-to-inference: guides/inference
how-to-manage: guides/repository
how-to-model-cards: guides/model-cards
how-to-upstream: guides/upload
search-the-hub: guides/search
guides/manage_spaces: guides/manage-spaces
package_reference/inference_api: package_reference/inference_client

# Alias for hf-transfer description
hf_transfer: package_reference/environment_variables#hfhubenablehftransfer
Wauplin marked this conversation as resolved.
Show resolved Hide resolved
79 changes: 79 additions & 0 deletions docs/source/hi/_toctree.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
- title: "शुरू हो जाओ"
sections:
- local: index
title: (होम) Home

Wauplin marked this conversation as resolved.
Show resolved Hide resolved
- local: quick-start
title: (जल्दी शुरू) Quickstart
- local: installation
title: (इंस्टालेशन) Installation
- title: "कैसे करें मार्गदर्शन"
sections:
- local: guides/overview
title: (निरीक्षण) Overview
- local: guides/download
title: (फ़ाइलें डाउनलोड करें) Download files
- local: guides/upload
title: (फाइलें अपलोड करें) Upload files
- local: guides/hf_file_system
title: (एचएफफ़ाइलसिस्टम) HfFileSystem
- local: guides/repository
title: (कोष) Repository
- local: guides/search
title: (तलाश) Search
- local: guides/inference
title: (अनुमान) Inference
- local: guides/community
title: (समुदाय टैब) Community Tab
- local: guides/collections
title: (संग्रह) Collections
- local: guides/manage-cache
title: (द्रुतिका) Cache
- local: guides/model-cards
title: (मॉडल कार्ड) Model Cards
- local: guides/manage-spaces
title: (अपना स्पेस प्रबंधित करें) Manage your Space
- local: guides/integrations
title: (एक library एकीकृत करें) Integrate a library
- local: guides/webhooks_server
title: (वेबहुक सर्वर) Webhooks server
- title: "वैचारिक मार्गदर्शक"
sections:
- local: concepts/git_vs_http
title: Git बनाम HTTP प्रतिमान
- title: "संदर्भ"
sections:
- local: package_reference/overview
title: (अवलोकन) Overview
- local: package_reference/login
title: (लॉगइन करें और लॉगआउट करें) Login and logout
- local: package_reference/environment_variables
title: (पर्यावरण चर) Environment variables
- local: package_reference/repository
title: (स्थानीय और ऑनलाइन रिपॉजिटरी का प्रबंधन करना) Managing local and online repositories
- local: package_reference/hf_api
title: (हगिंग फेस हब एपीआई) Hugging Face Hub API
- local: package_reference/file_download
title: (फ़ाइलें डाउनलोड हो रही हैं) Downloading files
- local: package_reference/mixins
title: (मिश्रण और क्रमांकन विधियाँ) Mixins & serialization methods
- local: package_reference/inference_client
title: (अनुमान ग्राहक) Inference Client
- local: package_reference/hf_file_system
title: (एचएफफ़ाइलसिस्टम) HfFileSystem
- local: package_reference/utilities
title: (उपयोगिताओं) Utilities
- local: package_reference/community
title: (चर्चाएँ और अनुरोध खींचें) Discussions and Pull Requests
- local: package_reference/cache
title: (कैश-सिस्टम संदर्भ) Cache-system reference
- local: package_reference/cards
title: (रेपो कार्ड और रेपो कार्ड डेटा) Repo Cards and Repo Card Data
- local: package_reference/space_runtime
title: (स्पेस रनटाइम) Space runtime
- local: package_reference/collections
title: (संग्रह) Collections
- local: package_reference/tensorboard
title: (टेंसरबोर्ड logger) TensorBoard logger
- local: package_reference/webhooks_server
title: (वेबहुक सर्वर) Webhooks server
Wauplin marked this conversation as resolved.
Show resolved Hide resolved
62 changes: 62 additions & 0 deletions docs/source/hi/concepts/git_vs_http.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!--⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this file is not translated and not referenced in the toctree, can you remove it from the PR?
(same for all files in /concepts and /guides)

rendered properly in your Markdown viewer.
-->

# Git vs HTTP paradigm

The `huggingface_hub` library is a library for interacting with the Hugging Face Hub, which is a
collections of git-based repositories (models, datasets or Spaces). There are two main
ways to access the Hub using `huggingface_hub`.

The first approach, the so-called "git-based" approach, is led by the [`Repository`] class.
This method uses a wrapper around the `git` command with additional functions specifically
designed to interact with the Hub. The second option, called the "HTTP-based" approach,
involves making HTTP requests using the [`HfApi`] client. Let's examine the pros and cons
of each approach.

## Repository: the historical git-based approach

At first, `huggingface_hub` was mostly built around the [`Repository`] class. It provides
Python wrappers for common `git` commands such as `"git add"`, `"git commit"`, `"git push"`,
`"git tag"`, `"git checkout"`, etc.

The library also helps with setting credentials and tracking large files, which are often
used in machine learning repositories. Additionally, the library allows you to execute its
methods in the background, making it useful for uploading data during training.

The main advantage of using a [`Repository`] is that it allows you to maintain a local
copy of the entire repository on your machine. This can also be a disadvantage as
it requires you to constantly update and maintain this local copy. This is similar to
traditional software development where each developer maintains their own local copy and
pushes changes when working on a feature. However, in the context of machine learning,
this may not always be necessary as users may only need to download weights for inference
or convert weights from one format to another without the need to clone the entire
repository.

<Tip warning={true}>

[`Repository`] is now deprecated in favor of the http-based alternatives. Given its large adoption in legacy code, the complete removal of [`Repository`] will only happen in release `v1.0`.

</Tip>

## HfApi: a flexible and convenient HTTP client

The [`HfApi`] class was developed to provide an alternative to local git repositories, which
can be cumbersome to maintain, especially when dealing with large models or datasets. The
[`HfApi`] class offers the same functionality as git-based approaches, such as downloading
and pushing files and creating branches and tags, but without the need for a local folder
that needs to be kept in sync.

In addition to the functionalities already provided by `git`, the [`HfApi`] class offers
additional features, such as the ability to manage repos, download files using caching for
efficient reuse, search the Hub for repos and metadata, access community features such as
discussions, PRs, and comments, and configure Spaces hardware and secrets.

## What should I use ? And when ?

Overall, the **HTTP-based approach is the recommended way to use** `huggingface_hub`
in all cases. [`HfApi`] allows to pull and push changes, work with PRs, tags and branches, interact with discussions and much more. Since the `0.16` release, the http-based methods can also run in the background, which was the last major advantage of the [`Repository`] class.

However, not all git commands are available through [`HfApi`]. Some may never be implemented, but we are always trying to improve and close the gap. If you don't see your use case covered, please open [an issue on Github](https://github.com/huggingface/huggingface_hub)! We welcome feedback to help build the 🤗 ecosystem with and for our users.

This preference of the http-based [`HfApi`] over the git-based [`Repository`] does not mean that git versioning will disappear from the Hugging Face Hub anytime soon. It will always be possible to use `git` commands locally in workflows where it makes sense.
187 changes: 187 additions & 0 deletions docs/source/hi/guides/collections.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<!--⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
rendered properly in your Markdown viewer.
-->

# Collections

A collection is a group of related items on the Hub (models, datasets, Spaces, papers) that are organized together on the same page. Collections are useful for creating your own portfolio, bookmarking content in categories, or presenting a curated list of items you want to share. Check out this [guide](https://huggingface.co/docs/hub/collections) to understand in more detail what collections are and how they look on the Hub.

You can directly manage collections in the browser, but in this guide, we will focus on how to manage it programmatically.

## Fetch a collection

Use [`get_collection`] to fetch your collections or any public ones. You must have the collection's *slug* to retrieve a collection. A slug is an identifier for a collection based on the title and a unique ID. You can find the slug in the URL of the collection page.

<div class="flex justify-center">
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hfh_collection_slug.png"/>
</div>

Let's fetch the collection with, `"TheBloke/recent-models-64f9a55bb3115b4f513ec026"`:

```py
>>> from huggingface_hub import get_collection
>>> collection = get_collection("TheBloke/recent-models-64f9a55bb3115b4f513ec026")
>>> collection
Collection: {
{'description': "Models I've recently quantized.',
'items': [...],
'last_updated': datetime.datetime(2023, 9, 21, 7, 26, 28, 57000, tzinfo=datetime.timezone.utc),
'owner': 'TheBloke',
'position': 1,
'private': False,
'slug': 'TheBloke/recent-models-64f9a55bb3115b4f513ec026',
'theme': 'green',
'title': 'Recent models'}
}
>>> collection.items[0]
CollectionItem: {
{'item_object_id': '6507f6d5423b46492ee1413e',
'author': 'TheBloke',
'item_id': 'TheBloke/TigerBot-70B-Chat-GPTQ',
'item_type': 'model',
'lastModified': '2023-09-19T12:55:21.000Z',
'position': 0,
'private': False,
'repoType': 'model'
(...)
}
}
```

The [`Collection`] object returned by [`get_collection`] contains:
- high-level metadata: `slug`, `owner`, `title`, `description`, etc.
- a list of [`CollectionItem`] objects; each item represents a model, a dataset, a Space, or a paper.

All collection items are guaranteed to have:
- a unique `item_object_id`: this is the id of the collection item in the database
- an `item_id`: this is the id on the Hub of the underlying item (model, dataset, Space, paper); it is not necessarily unique, and only the `item_id`/`item_type` pair is unique
- an `item_type`: model, dataset, Space, paper
- the `position` of the item in the collection, which can be updated to reorganize your collection (see [`update_collection_item`] below)

A `note` can also be attached to the item. This is useful to add additional information about the item (a comment, a link to a blog post, etc.). The attribute still has a `None` value if an item doesn't have a note.

In addition to these base attributes, returned items can have additional attributes depending on their type: `author`, `private`, `lastModified`, `gated`, `title`, `likes`, `upvotes`, etc. None of these attributes are guaranteed to be returned.

## Create a new collection

Now that we know how to get a [`Collection`], let's create our own! Use [`create_collection`] with a title and description. To create a collection on an organization page, pass `namespace="my-cool-org"` when creating the collection. Finally, you can also create private collections by passing `private=True`.

```py
>>> from huggingface_hub import create_collection

>>> collection = create_collection(
... title="ICCV 2023",
... description="Portfolio of models, papers and demos I presented at ICCV 2023",
... )
```

It will return a [`Collection`] object with the high-level metadata (title, description, owner, etc.) and an empty list of items. You will now be able to refer to this collection using it's `slug`.

```py
>>> collection.slug
'owner/iccv-2023-15e23b46cb98efca45'
>>> collection.title
"ICCV 2023"
>>> collection.owner
"username"
>>> collection.url
'https://huggingface.co/collections/owner/iccv-2023-15e23b46cb98efca45'
```

## Manage items in a collection

Now that we have a [`Collection`], we want to add items to it and organize them.

### Add items

Items have to be added one by one using [`add_collection_item`]. You only need to know the `collection_slug`, `item_id` and `item_type`. Optionally, you can also add a `note` to the item (500 characters maximum).

```py
>>> from huggingface_hub import create_collection, add_collection_item

>>> collection = create_collection(title="OS Week Highlights - Sept 18 - 24", namespace="osanseviero")
>>> collection.slug
"osanseviero/os-week-highlights-sept-18-24-650bfed7f795a59f491afb80"

>>> add_collection_item(collection.slug, item_id="coqui/xtts", item_type="space")
>>> add_collection_item(
... collection.slug,
... item_id="warp-ai/wuerstchen",
... item_type="model",
... note="Würstchen is a new fast and efficient high resolution text-to-image architecture and model"
... )
>>> add_collection_item(collection.slug, item_id="lmsys/lmsys-chat-1m", item_type="dataset")
>>> add_collection_item(collection.slug, item_id="warp-ai/wuerstchen", item_type="space") # same item_id, different item_type
```

If an item already exists in a collection (same `item_id`/`item_type` pair), an HTTP 409 error will be raised. You can choose to ignore this error by setting `exists_ok=True`.

### Add a note to an existing item

You can modify an existing item to add or modify the note attached to it using [`update_collection_item`]. Let's reuse the example above:

```py
>>> from huggingface_hub import get_collection, update_collection_item

# Fetch collection with newly added items
>>> collection_slug = "osanseviero/os-week-highlights-sept-18-24-650bfed7f795a59f491afb80"
>>> collection = get_collection(collection_slug)

# Add note the `lmsys-chat-1m` dataset
>>> update_collection_item(
... collection_slug=collection_slug,
... item_object_id=collection.items[2].item_object_id,
... note="This dataset contains one million real-world conversations with 25 state-of-the-art LLMs.",
... )
```

### Reorder items

Items in a collection are ordered. The order is determined by the `position` attribute of each item. By default, items are ordered by appending new items at the end of the collection. You can update the order using [`update_collection_item`] the same way you would add a note.

Let's reuse our example above:

```py
>>> from huggingface_hub import get_collection, update_collection_item

# Fetch collection
>>> collection_slug = "osanseviero/os-week-highlights-sept-18-24-650bfed7f795a59f491afb80"
>>> collection = get_collection(collection_slug)

# Reorder to place the two `Wuerstchen` items together
>>> update_collection_item(
... collection_slug=collection_slug,
... item_object_id=collection.items[3].item_object_id,
... position=2,
... )
```

### Remove items

Finally, you can also remove an item using [`delete_collection_item`].

```py
>>> from huggingface_hub import get_collection, update_collection_item

# Fetch collection
>>> collection_slug = "osanseviero/os-week-highlights-sept-18-24-650bfed7f795a59f491afb80"
>>> collection = get_collection(collection_slug)

# Remove `coqui/xtts` Space from the list
>>> delete_collection_item(collection_slug=collection_slug, item_object_id=collection.items[0].item_object_id)
```

## Delete collection

A collection can be deleted using [`delete_collection`].

<Tip warning={true}>

This is a non-revertible action. A deleted collection cannot be restored.

</Tip>

```py
>>> from huggingface_hub import delete_collection
>>> collection = delete_collection("username/useless-collection-64f9a55bb3115b4f513ec026", missing_ok=True)
```
Loading