-
Notifications
You must be signed in to change notification settings - Fork 812
Refactor push_to_hub #1883
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
Refactor push_to_hub #1883
Conversation
repo, | ||
'configuration.json', ['{"framework": "pytorch", "task": "text-generation", "allow_remote": true}'], | ||
ignore_push_error=True) | ||
# Add '*.sagemaker' to .gitignore if using SageMaker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个代码是从hf改的?怎么会想去特殊处理sagemaker环境。。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的,这里来自于之前的代码,处理sagemaker可能更好一些,毕竟影响ms和lf两个框架
logger = logging.get_logger(__name__) | ||
|
||
|
||
class PushToMsHubMixin: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
处理了ms和hf,是不是应该叫 PushToHubMixin 更通用一点
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没有处理hf,hf直接跳过这里走原来的逻辑
oid=None, | ||
) | ||
|
||
if not _use_hf_hub: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么not use hf的时候处理了hf专门的逻辑,是写反了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没写反,这里直接hack底层的create/upload逻辑
hub_token = os.environ.get('MODELSCOPE_API_TOKEN') | ||
if hub_token is not None: | ||
api.login(hub_token) | ||
visibility = ModelVisibility.PRIVATE if hub_private_repo else ModelVisibility.PUBLIC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else要报错吧。没有token是push不了的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
swift/trainers/push_to_ms.py
Outdated
user_name = ModelScopeConfig.get_user_info()[0] | ||
assert isinstance(user_name, str) | ||
hub_model_id = f'{user_name}/{hub_model_id}' | ||
logger.info(f"'/' not in hub_model_id, setting hub_model_id: {hub_model_id}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'/' not in hub_model_id, pushing to personal repo {hub_model_id}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
* main: (95 commits) support custom quantized dataset (modelscope#1893) Fix push_to_hub when last-checkpoint (modelscope#1897) bump version Add some warnings and fix RLHF (modelscope#1890) add vllm lmdeploy benchmark (modelscope#1889) Fix push to hub logic (modelscope#1888) Refactor push_to_hub (modelscope#1883) support qwen2-vl gptq awq (modelscope#1884) Support freeze_vit (modelscope#1880) use model.generation_config (modelscope#1850) add duet (modelscope#1877) fix doc (modelscope#1875) Fix num_proc (modelscope#1874) Add train record (modelscope#1873) [TorchAcc] fix serveral bugs for torchacc FSDP. (modelscope#1872) Support faster data map (modelscope#1871) update docs update docs qwen2-vl (modelscope#1869) update (modelscope#1864) update qwen2-vl docs (modelscope#1861) ... # Conflicts: # swift/llm/sft.py # swift/llm/utils/template.py
PR type
PR information
Write the detail information belongs to this PR.
Experiment results
Paste your experiment result here(if needed).