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

[doc] add examples and minor updates #1071

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

zyaoj
Copy link
Contributor

@zyaoj zyaoj commented Feb 27, 2025

What does this PR do? Please describe:

  • added a load model example to showcase model hub
  • revised dataset example given the latest changes
  • update nits in tutorials

Does your PR introduce any breaking changes? If yes, please list them:

N/A

Check list:

  • Was the content of this PR discussed and approved via a GitHub issue? (no need for typos or documentation improvements)
  • Did you read the contributor guideline?
  • Did you make sure that your PR does only one thing instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (no need for typos, documentation, or minor internal changes)

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 27, 2025
@zyaoj zyaoj requested review from uralik and cbalioglu February 27, 2025 17:17
@zyaoj zyaoj changed the title add examples and minor updates [doc] add examples and minor updates Feb 27, 2025
@@ -34,7 +34,7 @@
" load_text_tokenizer,\n",
" setup_gangs,\n",
")\n",
"from fairseq2.recipes.config import GangSection\n",
"from fairseq2.recipes.config import GangSection, ModelSection\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

why defining it as

dataset_config.name = "gsm8k_sft"
dataset_config.path = Path("/path/to/gsm8k_data/sft")

and not directly like

dataset_config = InstructionFinetuneDatasetSection(name = "gsm8k_sft", path = Path("/path/to/gsm8k_data/sft"))

?

Copy link
Contributor

Choose a reason for hiding this comment

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

same question for config = Config() # instantiate an object

Copy link
Contributor

@artemru artemru Mar 20, 2025

Choose a reason for hiding this comment

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

it would be interesting to say something about the expected data format in "/path/to/gsm8k_data/sft" (unless it's explained elsewhere) !

Comment on lines +94 to +97
"config = Config() # instantiate an object\n",
"config.gang = GangSection(tensor_parallel_size=1)\n",
"config.dataset = dataset_config\n",
"config.model = ModelSection(name=\"llama3_1_8b\")\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"config = Config() # instantiate an object\n",
"config.gang = GangSection(tensor_parallel_size=1)\n",
"config.dataset = dataset_config\n",
"config.model = ModelSection(name=\"llama3_1_8b\")\n",
"config = Config(gang = GangSection(tensor_parallel_size=1), dataset = dataset_config, model = ModelSection(name=\"llama3_1_8b\"))

would this work as well ?

" dropout_p=0.1 # Dropout probability\n",
")\n",
"\n",
"model = create_llama_model(custom_config)\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

nit : maybe add a comment that this will init a model with some random weights.
I would show also device and dtype args that are important here

"cell_type": "markdown",
"metadata": {},
"source": [
"You can also fetch some config presets from model hub."
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"You can also fetch some config presets from model hub."
"You can also fetch some registered configs available in model hub."

"model_hub = get_llama_model_hub()\n",
"model_config = model_hub.load_config(\"llama3_1_8b_instruct\") # use llama3.1 8b preset as an example\n",
"\n",
"llama_model = create_llama_model(model_config)\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

can you show also a path with llama_model = model_hub.load(model_card) ?

Comment on lines +216 to +218
"from fairseq2.context import get_runtime_context\n",
"context = get_runtime_context()\n",
"asset_store = context.asset_store"
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe some comment about why context and how it's related the fs2 possible extensions.

"outputs": [
{
"data": {
"text/plain": [
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we DONT want to share our clusters info here ?it will not be relevant for general purpose usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants