Model Card for Model ID
Model Details
Model Description
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
- Developed by: [More Information Needed]
- Funded by [optional]: [More Information Needed]
- Shared by [optional]: [More Information Needed]
- Model type: [More Information Needed]
- Language(s) (NLP): [More Information Needed]
- License: [More Information Needed]
- Finetuned from model [optional]: [More Information Needed]
Model Sources [optional]
- Repository: [More Information Needed]
- Paper [optional]: [More Information Needed]
- Demo [optional]: [More Information Needed]
Uses
Direct Use
[More Information Needed]
Downstream Use [optional]
[More Information Needed]
Out-of-Scope Use
[More Information Needed]
Bias, Risks, and Limitations
[More Information Needed]
Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
How to Get Started with the Model
Use the code below to get started with the model.
#Hugging Faceにアップロードしたモデルを用いて推論する方法
#提出したjsonlファイルの出力方法
#必要なライブラリのインストール:
1!pip install -U bitsandbytes
2!pip install -U transformers
3!pip install -U accelerate
4!pip install -U datasets
5!pip install -U peft
6!pip install ipywidgets --upgrade
#推論とjsonlファイルの出力:
1from transformers import (
2 AutoModelForCausalLM,
3 AutoTokenizer,
4 BitsAndBytesConfig,
5)
6from peft import PeftModel
7import torch
8from tqdm import tqdm
9import json
10
11HF_TOKEN = "Your Hagging Face Token"
12
13model_id = "models/models--llm-jp--llm-jp-3-13b/snapshots/cd3823f4c1fcbb0ad2e2af46036ab1b0ca13192a"
14adapter_id = "SGAT/llm-jp-3-13b-finetune"
15
16bnb_config = BitsAndBytesConfig(
17 load_in_4bit=True,
18 bnb_4bit_quant_type="nf4",
19 bnb_4bit_compute_dtype=torch.bfloat16,
20)
21
22model = AutoModelForCausalLM.from_pretrained(
23 model_id,
24 quantization_config=bnb_config,
25 device_map="auto",
26 token = HF_TOKEN
27)
28
29tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True, token = HF_TOKEN)
30
31model = PeftModel.from_pretrained(model, adapter_id, token = HF_TOKEN)
32
33datasets = []
34with open("./elyza-tasks-100-TV_0.jsonl", "r") as f:
35 item = ""
36 for line in f:
37 line = line.strip()
38 item += line
39 if item.endswith("}"):
40 datasets.append(json.loads(item))
41 item = ""
42
43results = []
44for data in tqdm(datasets):
45
46 input = data["input"]
47
48 prompt = f"""### 指示
49 {input}
50 ### 回答
51 """
52
53 tokenized_input = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt").to(model.device)
54 attention_mask = torch.ones_like(tokenized_input)
55 with torch.no_grad():
56 outputs = model.generate(
57 tokenized_input,
58 attention_mask=attention_mask,
59 max_new_tokens=100,
60 do_sample=False,
61 repetition_penalty=1.2,
62 pad_token_id=tokenizer.eos_token_id
63 )[0]
64 output = tokenizer.decode(outputs[tokenized_input.size(1):], skip_special_tokens=True)
65
66 results.append({"task_id": data["task_id"], "input": input, "output": output})
67
68import re
69jsonl_id = re.sub(".*/", "", adapter_id)
70with open(f"./{jsonl_id}-outputs.jsonl", 'w', encoding='utf-8') as f:
71 for result in results:
72 json.dump(result, f, ensure_ascii=False) # ensure_ascii=False for handling non-ASCII characters
73 f.write('\n')
[More Information Needed]
Training Details
Training Data
[More Information Needed]
Training Procedure
Preprocessing [optional]
[More Information Needed]
Training Hyperparameters
- Training regime: [More Information Needed]
Speeds, Sizes, Times [optional]
[More Information Needed]
Evaluation
Testing Data, Factors & Metrics
Testing Data
[More Information Needed]
Factors
[More Information Needed]
Metrics
[More Information Needed]
Results
[More Information Needed]
Summary
Model Examination [optional]
[More Information Needed]
Environmental Impact
Carbon emissions can be estimated using the
Machine Learning Impact calculator presented in
Lacoste et al. (2019).
- Hardware Type: [More Information Needed]
- Hours used: [More Information Needed]
- Cloud Provider: [More Information Needed]
- Compute Region: [More Information Needed]
- Carbon Emitted: [More Information Needed]
Technical Specifications [optional]
Model Architecture and Objective
[More Information Needed]
Compute Infrastructure
[More Information Needed]
Hardware
[More Information Needed]
Software
[More Information Needed]
Citation [optional]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
Glossary [optional]
[More Information Needed]
More Information [optional]
[More Information Needed]
Model Card Authors [optional]
[More Information Needed]
Model Card Contact
[More Information Needed]