Skip to content
Merged
Changes from 2 commits
Commits
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
2 changes: 1 addition & 1 deletion templates/fine-tune-llm/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def generate_model_tag(model_id: str) -> str:
"""
username = os.environ.get("ANYSCALE_USERNAME")
if username:
username = username[:5]
username = username.strip().replace(" ", "_")[:5]
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this may add _ to the end sometimes

>>> username = "Kyle abcde"
>>> username = username.strip().replace(" ", "_")[:5]
>>> username
'Kyle_'

You can avoid that by following

username[:5].strip().replace(" ", "_")

But with my suggestion you could end up with username less than 5 characters sometimes

Copy link

Choose a reason for hiding this comment

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

Is it OK to have username less than 5?
I actually submitted a PR #126 to append username to be 5

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated logic so we never have _ in case there are issues with it and always padded it to be length 5.

I think it's okay to have username less than 5 but just in case it's length 0 for some reason, I always added padding

else:
username = "".join(random.choice(string.ascii_lowercase) for _ in range(5))
suffix = "".join(random.choice(string.ascii_lowercase) for _ in range(5))
Expand Down