peft safetensors en dataset:TheFusion21/PokemonCards base_model:HuggingFaceM4/idefics-9b region:us
---
library_name: peft
base_model: HuggingFaceM4/idefics-9b
datasets:
- TheFusion21/PokemonCards
language:
- en
---

# Model Card for ckandemir/idefics-9b-pokemon-peft Model

This model card provides an overview of a fine-tuned version of the idefics-9b model, specialized in understanding and generating content related to Pokémon cards.



## Model Details

### Model Description

The model is a fine-tuned derivative of the large-scale [`HuggingFaceM4/idefics-9b`](https://huggingface.co/HuggingFaceM4/idefics-9b-instruct), leveraging the PEFT. It is specialized in tasks related to Pokémon card data, capable of various NLP tasks like text generation, classification, and analysis within the context of Pokémon trading cards.


- **Finetuned from model [optional]:** [HuggingFaceM4/idefics-9b](https://huggingface.co/HuggingFaceM4/idefics-9b-instruct)

### Direct Use

The model is designed for direct use in applications involving Pokémon card data analysis, generation, and enrichment tasks.

### Downstream Use 

Further fine-tuning on other niche domains could enable the model to perform specialized tasks in additional contexts beyond Pokémon cards.


### Out-of-Scope Use

The model may not perform well on general NLP tasks unrelated to Pokémon data or vastly different domains without further fine-tuning.


## Bias, Risks, and Limitations

The model may inherit biases present in the Pokémon card dataset and may not generalize well to other contexts. Use in sensitive areas should be with caution.


### Recommendations

Users should be aware of the model's specialized nature and its limitations when applied outside its intended domain.
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.

[More Information Needed]

## Training Details

### Training Data

The model was trained on the `TheFusion21/PokemonCards` dataset from HuggingFace. Initially, the dataset underwent a cleaning process to remove any invalid URLs that could disrupt the training pipeline. Subsequently, the data was preprocessed to align with the model's input requirements, ensuring efficient and error-free training.

### Training Procedure 

The dataset was preprocessed to fit the model's input requirements, with special attention to tokenization and formatting.
#### Preprocessing [optional]

[More Information Needed]


#### Training Hyperparameters

- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->

#### Speeds, Sizes, Times [optional]

<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->



## Training procedure


The following `bitsandbytes` quantization config was used during training:
- quant_method: bitsandbytes
- load_in_8bit: False
- load_in_4bit: True
- llm_int8_threshold: 6.0
- llm_int8_skip_modules: ['lm_head', 'embed_tokens']
- llm_int8_enable_fp32_cpu_offload: False
- llm_int8_has_fp16_weight: False
- bnb_4bit_quant_type: nf4
- bnb_4bit_use_double_quant: True
- bnb_4bit_compute_dtype: float16

### Framework versions


- PEFT 0.6.2.dev0

### Code

```python
from peft import PeftModel, PeftConfig

peft_model_id='ckandemir/idefics-9b-pokemon-peft'
quantization_config = BitsAndBytesConfig(
                                load_in_4bit=True,
                                bnb_4bit_use_double_quant=True,
                                bnb_4bit_quant_type="nf4",
                                bnb_4bit_compute_dtype=torch.float16,
                                llm_int8_skip_modules=["lm_head", "embed_tokens"],
                            )
config = PeftConfig.from_pretrained(peft_model_id)
# Load the model with the appropriate configuration for inference
model = IdeficsForVisionText2Text.from_pretrained(config.base_model_name_or_path, quantization_config=quantization_config, device_map="auto")
processor = AutoProcessor.from_pretrained(config.base_model_name_or_path)

model = PeftModel.from_pretrained(model, peft_model_id, device_map={"":0})

```