docstr: Parses a string in the format "[namespace/]model_name[@revision]" to a HuggingFaceModelConfig.
  
  Examples:
  - 'gpt2'
  - 'stanford-crfm/BioMedLM'
  - 'stanford-crfm/BioMedLM@main'
docstr_tok: ["Parses","a","string","in","the","format","``","[","namespace\/","]","model_name","[","@","revision","]","''","to","a","HuggingFaceModelConfig",".","Examples",":","-","'gpt2'","-","'stanford-crfm\/BioMedLM'","-","'stanford-crfm\/BioMedLM","@","main","'"]
code: def from_string(raw: str) -> "HuggingFaceModelConfig":
      """Parses a string in the format "[namespace/]model_name[@revision]" to a HuggingFaceModelConfig.
  
      Examples:
      - 'gpt2'
      - 'stanford-crfm/BioMedLM'
      - 'stanford-crfm/BioMedLM@main'"""
      pattern = r"((?P<namespace>[^/@]+)/)?(?P<model_name>[^/@]+)(@(?P<revision>[^/@]+))?"
      match = re.fullmatch(pattern, raw)
      if not match:
          raise ValueError(
              f"Could not parse model name: '{raw}'; Expected format: [namespace/]model_name[@revision]"
          )
      model_name = match.group("model_name")
      assert model_name
      return HuggingFaceModelConfig(
          namespace=match.group("namespace"),
          model_name=model_name,
          revision=match.group("revision"),
      )
  
file_path: H2O/h2o_hf/helm/src/helm/proxy/clients/huggingface_model_registry.py
imports: from typing import Dict, Optional
  from dataclasses import dataclass
  import re
  from helm.common.hierarchical_logger import hlog
  from helm.proxy.models import Model, ALL_MODELS, MODEL_NAME_TO_MODEL, TEXT_MODEL_TAG, FULL_FUNCTIONALITY_TEXT_MODEL_TAG
label_desc: Use image node_id 3 for calling the HuggingFaceModelConfig obj's underlying member method code with example usage: obj.from_string(raw) and returns: HuggingFaceModelConfig