GhaouiY's picture
Update README.md
42fdaf6 verified
|
raw
history blame
5.29 kB

Here’s the updated README file with the empty fields removed:


library_name: transformers
tags: [regulatory agent, OSHA, compliance, safety, legal filtering]

Agent Card for GhaouiY/gemma-2-9b-it_SafeguardAI

GhaouiY/gemma-2-9b-it_SafeguardAI is a specialized agent designed to handle regulatory and compliance-related queries. The agent is specifically trained to distinguish between safe-to-answer questions and those that require deferral to a qualified professional, focusing on OSHA standards, medical, legal, and life-or-death situations.

Agent Details

Agent Description

This agent, developed using Google's gemma2-9b-it architecture, acts as a regulatory agent responsible for identifying sensitive questions related to medical diagnosis or treatment, life-or-death situations, legal matters, and certification requirements. It provides clear, safe responses aligned with OSHA guidelines or advises users to consult professionals when necessary. The agent is particularly useful in environments where safety and compliance are critical.

  • Developed by: GhaouiY
  • Agent type: Causal Language Agent (gemma2-9b-it architecture)
  • Language(s) (NLP): English

Uses

Direct Use

The agent is used directly in environments that require automated handling of queries related to occupational safety, health regulations, legal concerns, and certification matters. It ensures compliance by providing only safe, approved responses or directing users to appropriate professionals.

Out-of-Scope Use

The agent is not designed to provide detailed medical, legal, or certification-related advice. Misuse of the agent for providing specific guidance in these areas could lead to incorrect or harmful outcomes.

Bias, Risks, and Limitations

The agent is designed to filter and avoid providing responses to sensitive queries, but it is not foolproof. Users should be aware that the agent's filtering mechanism is based on patterns learned from the training data and might not cover every possible scenario.

Recommendations

Users should be aware of the risks, biases, and limitations of the agent. It is strongly recommended to use the agent in conjunction with professional oversight, especially when handling critical safety, health, or legal matters.

How to Get Started with the Agent

Use the code below to get started with the agent.

from transformers import AutoTokenizer, AutoModelForCausalLM

agent_name = "GhaouiY/gemma-2-9b-it_SafeguardAI"

agent = AutoModelForCausalLM.from_pretrained(agent_name)
tokenizer = AutoTokenizer.from_pretrained(agent_name)

# Example usage
input_text = "How should I respond if I witness an unsafe work condition that could lead to an accident?"
inputs = tokenizer(input_text, return_tensors="pt")
outputs = agent.generate(**inputs)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)

print(response)

Training Details

Training Data

The agent was fine-tuned on a synthetic dataset generated by prompt-engineered GPT-4mini. The dataset comprises OSHA regulation Q&A pairs, focusing on workplace safety, regulatory compliance, and related queries. The training data includes carefully crafted questions and responses designed to emulate real-world scenarios.

Training Procedure

The agent underwent further fine-tuning using a LoRA (Low-Rank Adaptation) configuration with the following parameters:

  • LoRA Configuration:

    • r=64
    • lora_alpha=32
    • lora_dropout=0.05
    • target_modules=modules
    • Trainable Parameters: Calculated and displayed as part of the training process.
  • Training Regime: bf16 mixed precision

  • Batch Size: 1

  • Gradient Accumulation Steps: 4

  • Learning Rate: 2e-5

  • Number of Epochs: 1

  • Base Agent: gemma2-9b it

  • Fine-tuning Hardware: Paperspace A6000

  • Trainer: SFTTrainer (Weights & Biases integration with paged_adamw_8bit optimization)

The fine-tuning process involved prompt engineering and was tracked using Weights & Biases (wandb).

Evaluation

Testing Data, Factors & Metrics

The agent was evaluated using a test dataset comprising additional OSHA regulation queries and potential out-of-scope questions. The evaluation ensures that the agent can accurately distinguish between safe and sensitive queries.

Metrics

  • F1 Score: 90%
  • Recall: 84%

Results

The agent achieved a 90% F1 score and an 84% recall, demonstrating its effectiveness in identifying sensitive queries and providing appropriate responses.

Environmental Impact

  • Hardware Type: Paperspace A6000
  • Cloud Provider: Paperspace

Technical Specifications

Agent Architecture and Objective

The agent is based on Google's gemma2-9b-it architecture, fine-tuned specifically for regulatory compliance and query filtering.

Compute Infrastructure

  • Hardware: Paperspace A6000
  • Software: STF Trainer with Weights & Biases integration

Agent Card Contact

For questions, suggestions, or collaboration, please reach out via the Hugging Face agent card or GitHub.


This README file is now streamlined, with all unnecessary fields removed. Let me know if there's anything else you'd like to adjust!