amannagrawall002 commited on
Commit
356620f
1 Parent(s): 978b38c

Updated Auto-generated model card.

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. model_card.py +0 -90
README.md CHANGED
@@ -4,7 +4,7 @@ language: en
4
  tags:
5
  - bert-finetuned-mrpc
6
  - sequence-classification
7
- license: Apache-2.0
8
  input : pair of sentence.
9
  ---
10
 
 
4
  tags:
5
  - bert-finetuned-mrpc
6
  - sequence-classification
7
+ license: apache-2.0
8
  input : pair of sentence.
9
  ---
10
 
model_card.py DELETED
@@ -1,90 +0,0 @@
1
- from huggingface_hub import Repository, HfApi
2
- from transformers import AutoModelForSequenceClassification, AutoTokenizer, AutoConfig
3
- import json
4
-
5
- # Initialize the Hugging Face API client
6
- api = HfApi()
7
-
8
- # Use the existing local repository
9
- repo = Repository("local-folder")
10
- repo.git_pull()
11
-
12
- # Load the model, tokenizer, and config from the existing checkpoint
13
- checkpoint_directory = "bert-finetuned-mrpc"
14
- model = AutoModelForSequenceClassification.from_pretrained(checkpoint_directory)
15
- tokenizer = AutoTokenizer.from_pretrained(checkpoint_directory)
16
- config = AutoConfig.from_pretrained(checkpoint_directory)
17
-
18
- # Get the repository name
19
- repo_name = "amannagrawall002/bert-finetued-mrpc" # Replace this with your actual repository name
20
-
21
- # Generate model card content
22
- model_name = config.name_or_path.split('/')[-1]
23
- task = list(config.task_specific_params.keys())[0] if hasattr(config, 'task_specific_params') and config.task_specific_params else "sequence-classification"
24
- architecture = config.architectures[0] if hasattr(config, 'architectures') and config.architectures else "Unknown"
25
-
26
- model_card_content = f"""
27
- ---
28
- language: en
29
- tags:
30
- - {model_name}
31
- - {task}
32
- license: {config.license if hasattr(config, 'license') else 'unknown'}
33
- ---
34
-
35
- # {model_name.capitalize()} Fine-tuned for {task.replace('-', ' ').capitalize()}
36
-
37
- This model is a fine-tuned version of [{model_name}](https://huggingface.co/{config.name_or_path}) for {task.replace('-', ' ')} tasks.
38
-
39
- ## Model description
40
-
41
- - Model architecture: {architecture}
42
- - Task: {task}
43
- - Training dataset: {config._name_or_path if hasattr(config, '_name_or_path') else 'Unknown'}
44
- - Number of parameters: {model.num_parameters():,}
45
- - Sequence length: {config.max_position_embeddings}
46
- - Vocab size: {config.vocab_size}
47
- - Hidden size: {config.hidden_size}
48
- - Number of attention heads: {config.num_attention_heads}
49
- - Number of hidden layers: {config.num_hidden_layers}
50
-
51
- ## Intended uses & limitations
52
-
53
- This model is intended for {task.replace('-', ' ')} tasks. It has been fine-tuned on a specific dataset, so its performance may vary on different datasets or domains.
54
-
55
- ## Training procedure
56
-
57
- The model was fine-tuned using the following hyperparameters:
58
- {json.dumps(config.to_dict(), indent=2)}
59
-
60
- ## Evaluation results
61
-
62
- [Evaluation results to be added]
63
-
64
- """
65
-
66
- with open(f"{repo.local_dir}/README.md", "w") as f:
67
- f.write(model_card_content)
68
-
69
- # Add inference API code
70
- # pipeline_code = f"""
71
- # from transformers import pipeline
72
-
73
- # def inference(text):
74
- # classifier = pipeline("{task}", model="{repo_name}")
75
- # result = classifier(text)
76
- # return result
77
- # """
78
-
79
- # with open(f"{repo.local_dir}/api.py", "w") as f:
80
- # f.write(pipeline_code)
81
-
82
- # Commit and push changes
83
- repo.git_add()
84
- repo.git_commit("Added auto-generated model card")
85
- repo.git_push()
86
-
87
- # Enable the Inference API
88
- # api.add_space_secret(repo_name, "INFERENCE_ENDPOINT", f"https://api-inference.huggingface.co/models/{repo_name}")
89
-
90
- print("Auto-generated model card.")