How to ask questions on the forum?

Hi there and welcome on the HuggingFace forums!

Here are a few guidelines before you make your first post, but the goal is to create a wide discussion space with the NLP community, so don’t hesitate to break them if you feel they are too rigid. First, let’s have a look at the categories available.

Categories

The Beginners category is primarily intended for beginners (as you may have guessed from its name). Any question on any of the :hugs: libraries is welcome there, be it to debug some code or to ask for help about how to do something. That being said, if your question is only linked to one library in particular, you should probably head to the corresponding category on this forum.This category and the intermediate category are horizontal and more suited to problems that involve several :hugs: libraries.

The Intermediate category is for more advanced questions, for sharing your projects using any of the :hugs: libraries with the community, or to get help building them, coordinate with other users.

The Research category is where you would discuss the latest NLP paper. It also contains the awesome papers subcategory, which groups the interesting articles the Hugging Face team reviewed and commented during their Science Tuesdays.

Once you have selected your category, you should be ready to write you first topic.

Writing a new topic

Before writing a new topic, make sure there is not already one that addresses the same subject by doing a quick search. Discourse uses Markdown to format your posts, here is quick introduction that should get you started. Whenever you write a post, you get a preview in the window on the left.

When writing a post or replying to someone, remember to be friendly with other users. You can read more on this on the FAQ. In general, avoid tagging a person (especially the moderators or the admins) unless that person is really the only one that can help you.

Also remember that other users can’t read your thoughts. That means you should always show the code you’re trying when asking for help to debug something (see below) or the link to the paper you are referencing. In general, always provide all the necessary information so that others can easily help you and engage with you.

Getting help with an error

When trying to get help with an error, it’s very important to include as the following information:

  • First post all the code that leads to the problem. People will only be able to help you if they can reproduce your error. To format it properly in Markdown, place it between two lines containing ```.
  • Then copy the full error message. It may seem cryptic to you but it may contain something that another user will instantly recognize. Again, to format it properly in Markdown, place it between two lines containing ```.
  • Provide the version of the library you are using. For instance :hugs:Transformers has a command transformers-cli env you can type that returns details of your system installation.
  • If you have tried something in particular to solve your problem, don’t hesitate to mention it as well.

This may seem tedious but this is what will make the difference between a post that might be ignored and one that receives an answer in a a couple of hours.

52 Likes

I have a problem with “save_pretrained”.

In my labtop with Windows 10 (transformers 4.35.2, Xformers 0.0.21, diffusers 0.14.0, python 3.8.16), my script ‘image_pipe.save_pretrained(“output\my-finetuned-model”)’ doesn’t cause any error and works just fine.

However, in my another laptop with Windows11 where I recently installed Huggingface packages (transformers 4.33.3, Xformers 0.0.22.post7, diffusers 0.24.0, python 3.10.9), running the above script causes an error saying “Object of type WindowsPath is not JSON serializable”.

I modified my script several ways:

image_pipe.save_pretrained(str(“output\my-finetuned-model”))

image_pipe.save_pretrained(Path(“output\my-finetuned-model”))

image_pipe.save_pretrained(str(Path(“output\my-finetuned-model”)))

image_pipe.save_pretrained(os.path.join(“output”, “finetuned-model”))

etc…

But, none of them worked…
Any help??

Try it with a forward slash instead of a backslash so
Path('output/my-fine-tuned-model')

I tried it also and it didn’t work. Even a single folder name (not a path) didn’t work.

BTW, I simply downgraded the diffusers from 0.24.0 to 0.14.0 and my original script worked fine (no json serization error).

This means an error was introduced somewhere between 0.14.0 and 0.24.0. If you have time, please use binary search (a.k.a. 20 questions) to find the first version that breaks it and report the bug.

Apart from that, please note that the backslash in a normal Python string constant starts a special control sequence, e.g. ‘\t’ is used to obtain a tab character. For letters such as “m” that are (not yet) used in this way, the character is returned but the backslash eaten. This means that the first 3 attempts try to save to the single folder name (no path) “outputmy-finetuned-model”. This should be the same on Windows 10, Windows 11, Mac or Linux.

1 Like

Are you able to make additional pages to your comic if so how ? Sorry very new to this

Using the Huggingface code for this tutorial, I got and error: Could you help me please?

from transformers import TrainingArguments

training_args = TrainingArguments(“test-trainer”)

ImportError: Using the Trainer with PyTorch requires accelerate>=0.21.0: Please run pip install transformers[torch] or pip install accelerate -U

I did the install ,but it didnot fix the error