Instructions to use andy300/lora-teuken-fact20 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use andy300/lora-teuken-fact20 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("openGPT-X/Teuken-7B-instruct-research-v0.4") model = PeftModel.from_pretrained(base_model, "andy300/lora-teuken-fact20") - Transformers
How to use andy300/lora-teuken-fact20 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="andy300/lora-teuken-fact20")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("andy300/lora-teuken-fact20", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use andy300/lora-teuken-fact20 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "andy300/lora-teuken-fact20" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "andy300/lora-teuken-fact20", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/andy300/lora-teuken-fact20
- SGLang
How to use andy300/lora-teuken-fact20 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "andy300/lora-teuken-fact20" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "andy300/lora-teuken-fact20", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "andy300/lora-teuken-fact20" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "andy300/lora-teuken-fact20", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use andy300/lora-teuken-fact20 with Docker Model Runner:
docker model run hf.co/andy300/lora-teuken-fact20
- Model Card for lora-teuken-fact20
- Model Details
- Uses
- Bias, Risks, and Limitations
- How to Get Started with the Model
- Training Details
- Evaluation
- Model Examination [optional]
- Environmental Impact
- Technical Specifications [optional]
- Citation [optional]
- Glossary [optional]
- More Information [optional]
- Model Card Authors [optional]
- Model Card Contact
Model Card for lora-teuken-fact20
lora-teuken-fact20 is a LORA adapter for openGPT-X/Teuken-7B-instruct-research-v0.4.
Using the lora-adapter for Teuken 7B it is possible to get much more correct answers on the question:
Wich districts has a city. Wehre city may be e.g. Berlin or Essen.
Only the districts of the 20 biggest cities in germany are considered.
Language is german.
Model Details
Model Description
Teuken 7B (like other LLMs to) has problems with simple facts. E.g. if you ask it for the districts of the german city Dresden you will get varing results.
Using the dataset andy300/cities_bezirk_mp i finetuned openGPT-X/Teuken-7B-instruct-research-v0.4. The result is the LORA Adapter andy300/lora-teuken-fact20.
With the LORA Adapter Teuken 7B is able to answer with 233 correct dstricts from a total of 235 district of the 20 biggest cities in Germany. Pure Teuken 7B on the other gives 97 correct districts.
- Developed by: Andreas Wenzel
- Model type: LORA Adapter
- Language(s) (NLP): German
- License: MIT
- Finetuned from model: openGPT-X/Teuken-7B-instruct-research-v0.4
Model Sources
- Repository: https://github.com/awenzel67/teuken-fact20
Uses
This LORA Adapter improves Teuken 7B's ability to answer questions such as: "Which districts does the city of Berlin have?" Only the 20 largest cities in Germany are considered.
Bias, Risks, and Limitations
Using the LORA adapter changes slightly the properties of Teuken 7B.
How to Get Started with the Model
LORA adapter can be loaded for inference of openGPT-X/Teuken-7B-instruct-research-v0.4 with transformer or vLLM.
Transformer
The model requires the same python libraries as required by Teuken 7B.
python -m pip install numpy torch huggingface_hub transformers sentencepiece
Model and tokenizer is used like in the openGPT-X/Teuken-7B-instruct-research-v0.4 example.
Only the LORA-Adapter andy300/teuken-fact20 is added to the openGPT-X/Teuken-7B-instruct-research-v0.4 model with the model.load_adapter method.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model_name = "openGPT-X/Teuken-7B-instruct-research-v0.4"
adapter_name = "andy300/teuken-fact20"
model = AutoModelForCausalLM.from_pretrained(
model_name,
trust_remote_code=True,
torch_dtype=torch.bfloat16
)
model.load_adapter(adapter_name)
model = model.to(device).eval()
tokenizer = AutoTokenizer.from_pretrained(
model_name,
use_fast=False,
trust_remote_code=True,
)
messages = [{"role": "User", "content": "Kannst du mir eine Liste aller Stadtbezirke in München geben?"}]
prompt_ids = tokenizer.apply_chat_template(messages, chat_template="DE", tokenize=True, add_generation_prompt=True, return_tensors="pt")
prediction = model.generate(
prompt_ids.to(model.device),
max_length=512,
do_sample=True,
top_k=50,
top_p=0.95,
temperature=0.7,
num_return_sequences=1,
)
prediction_text = tokenizer.decode(prediction[0].tolist())
print(prediction_text)
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]
Framework versions
- PEFT 0.17.1
- Downloads last month
- 6
Model tree for andy300/lora-teuken-fact20
Base model
openGPT-X/Teuken-7B-base-v0.4