ibrahimlasfar commited on
Commit
419f982
·
1 Parent(s): 45850ea

first commit

Browse files
Files changed (6) hide show
  1. .dockerignore +6 -0
  2. .gitattributes +1 -0
  3. Dockerfile +10 -0
  4. README.md +71 -0
  5. app/main.py +25 -0
  6. requirements.txt +4 -0
.dockerignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ __pycache__
2
+ *.pyc
3
+ *.pyo
4
+ *.pyd
5
+ *.git
6
+ *.venv
.gitattributes ADDED
@@ -0,0 +1 @@
 
 
1
+ model/*.safetensors filter=lfs diff=lfs merge=lfs -text
Dockerfile ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ COPY . .
6
+
7
+ RUN pip install --no-cache-dir --upgrade pip
8
+ RUN pip install --no-cache-dir -r requirements.txt
9
+
10
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
README.md CHANGED
@@ -1,2 +1,73 @@
 
1
  # MGZON-AI
2
  A versatile chatbot powered by MGZON/Veltrix for MGZon queries. Supports code generation, analysis, review, web search, and MGZon-specific queries. Licensed under Apache 2.0.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <<<<<<< HEAD
2
  # MGZON-AI
3
  A versatile chatbot powered by MGZON/Veltrix for MGZon queries. Supports code generation, analysis, review, web search, and MGZon-specific queries. Licensed under Apache 2.0.
4
+ =======
5
+ ---
6
+ library_name: transformers
7
+ license: apache-2.0
8
+ 🌐 **Live Demo**
9
+ [Live Demo](https://huggingface.co/spaces/MGZON/mgzon-app)
10
+ base_model: MGZON/Veltrix
11
+ tags:
12
+ - generated_from_trainer
13
+ model-index:
14
+ - name: mgzon-flan-t5-base
15
+ results: []
16
+ ---
17
+
18
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
19
+ should probably proofread and complete it, then remove this comment. -->
20
+
21
+
22
+ # MGZON/Veltrix
23
+
24
+ This model is a fine-tuned version of [MGZON/Veltrix](https://huggingface.co/MGZON/Veltrix) on the None dataset.
25
+ It achieves the following results on the evaluation set:
26
+ - Loss: nan
27
+
28
+ ## Model description
29
+
30
+ More information needed
31
+
32
+ ## Intended uses & limitations
33
+
34
+ More information needed
35
+
36
+ ## Training and evaluation data
37
+
38
+ More information needed
39
+
40
+ ## Training procedure
41
+
42
+ ### Training hyperparameters
43
+
44
+ The following hyperparameters were used during training:
45
+ - learning_rate: 3e-05
46
+ - train_batch_size: 1
47
+ - eval_batch_size: 1
48
+ - seed: 42
49
+ - gradient_accumulation_steps: 2
50
+ - total_train_batch_size: 2
51
+ - optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
52
+ - lr_scheduler_type: linear
53
+ - num_epochs: 5
54
+ - mixed_precision_training: Native AMP
55
+
56
+ ### Training results
57
+
58
+ | Training Loss | Epoch | Step | Validation Loss |
59
+ |:-------------:|:-----:|:----:|:---------------:|
60
+ | 0.2456 | 1.0 | 1488 | nan |
61
+ | 0.0888 | 2.0 | 2976 | nan |
62
+ | 15.9533 | 3.0 | 4464 | nan |
63
+ | 0.1136 | 4.0 | 5952 | nan |
64
+ | 0.0626 | 5.0 | 7440 | nan |
65
+
66
+
67
+ ### Framework versions
68
+
69
+ - Transformers 4.55.2
70
+ - Pytorch 2.8.0+cu126
71
+ - Datasets 4.0.0
72
+ - Tokenizers 0.21.4
73
+ >>>>>>> 38501a7 (Initial commit with API and model)
app/main.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from pydantic import BaseModel
3
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
4
+ import torch
5
+
6
+ app = FastAPI(title="MGZON FLAN-T5 API")
7
+
8
+ # تحميل النموذج من Hugging Face مباشرة
9
+ MODEL_NAME = "MGZON/mgzon-flan-t5-base"
10
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
11
+ model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_NAME)
12
+
13
+ class RequestText(BaseModel):
14
+ text: str
15
+ max_length: int = 200
16
+
17
+ @app.post("/generate/")
18
+ async def generate(req: RequestText):
19
+ inputs = tokenizer(req.text, return_tensors="pt")
20
+ outputs = model.generate(**inputs, max_length=req.max_length)
21
+ return {"generated_text": tokenizer.decode(outputs[0], skip_special_tokens=True)}
22
+
23
+ @app.get("/")
24
+ async def root():
25
+ return {"message": "MGZON FLAN-T5 API is running"}
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ fastapi
2
+ uvicorn[standard]
3
+ transformers
4
+ torch