Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Only do model name translation for Llama-2 and CodeLlama (#37)
Browse files- Only do model name translation for Llama-2 and CodeLlama (42eec7514b6f5ccc839b42a383246dc8a42c1ec6)
Co-authored-by: Kien Nguyen <sudokien@users.noreply.huggingface.co>
26 unmodified lines27282930313233341 unmodified line363738394041424326 unmodified linesreturn path[1:]def translate_llama2(text):"Translates llama-2 to its hf counterpart"if not text.endswith("-hf"):return text + "-hf"return text1 unmodified linedef get_model(model_name: str, library: str, access_token: str):"Finds and grabs model from the Hub, and initializes on `meta`"if "meta-llama" in model_name:model_name = translate_llama2(model_name)if library == "auto":library = Nonemodel_name = extract_from_url(model_name)26 unmodified lines27282930313233341 unmodified line363738394041424326 unmodified linesreturn path[1:]def translate_llama(text):"Translates Llama-2 and CodeLlama to its hf counterpart"if not text.endswith("-hf"):return text + "-hf"return text1 unmodified linedef get_model(model_name: str, library: str, access_token: str):"Finds and grabs model from the Hub, and initializes on `meta`"if "meta-llama/Llama-2-" in model_name or "meta-llama/CodeLlama-" in model_name:model_name = translate_llama(model_name)if library == "auto":library = Nonemodel_name = extract_from_url(model_name)
src/model_utils.py+4-4