Spaces:
Build error
Build error
Commit
·
109e44b
1
Parent(s):
10c1d89
init
Browse files- .idea/.gitignore +3 -0
- .idea/blip2-debunker.iml +8 -0
- .idea/inspectionProfiles/profiles_settings.xml +6 -0
- .idea/misc.xml +4 -0
- .idea/modules.xml +8 -0
- .idea/vcs.xml +6 -0
- app.py +35 -0
- blip2_fakenews_all/adapter_config.json +19 -0
- blip2_fakenews_all/adapter_model.bin +3 -0
.idea/.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
# Default ignored files
|
2 |
+
/shelf/
|
3 |
+
/workspace.xml
|
.idea/blip2-debunker.iml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<module type="PYTHON_MODULE" version="4">
|
3 |
+
<component name="NewModuleRootManager">
|
4 |
+
<content url="file://$MODULE_DIR$" />
|
5 |
+
<orderEntry type="jdk" jdkName="Python 3.9 (qust_new)" jdkType="Python SDK" />
|
6 |
+
<orderEntry type="sourceFolder" forTests="false" />
|
7 |
+
</component>
|
8 |
+
</module>
|
.idea/inspectionProfiles/profiles_settings.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<component name="InspectionProjectProfileManager">
|
2 |
+
<settings>
|
3 |
+
<option name="USE_PROJECT_PROFILE" value="false" />
|
4 |
+
<version value="1.0" />
|
5 |
+
</settings>
|
6 |
+
</component>
|
.idea/misc.xml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (qust_new)" project-jdk-type="Python SDK" />
|
4 |
+
</project>
|
.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectModuleManager">
|
4 |
+
<modules>
|
5 |
+
<module fileurl="file://$PROJECT_DIR$/.idea/blip2-debunker.iml" filepath="$PROJECT_DIR$/.idea/blip2-debunker.iml" />
|
6 |
+
</modules>
|
7 |
+
</component>
|
8 |
+
</project>
|
.idea/vcs.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="VcsDirectoryMappings">
|
4 |
+
<mapping directory="" vcs="Git" />
|
5 |
+
</component>
|
6 |
+
</project>
|
app.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import Blip2Processor, Blip2ForConditionalGeneration
|
2 |
+
from peft import LoraConfig, get_peft_model, PeftModel
|
3 |
+
import torch
|
4 |
+
import streamlit as st
|
5 |
+
|
6 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
7 |
+
|
8 |
+
config = LoraConfig(
|
9 |
+
r=16,
|
10 |
+
lora_alpha=32,
|
11 |
+
lora_dropout=0.05,
|
12 |
+
bias="none",
|
13 |
+
)
|
14 |
+
|
15 |
+
# model_name = "/home/yejiang/blip2_fakedit/saved_model/blip2_fakenews_all"
|
16 |
+
#
|
17 |
+
# processor = Blip2Processor.from_pretrained("Salesforce/blip2-flan-t5-xl")
|
18 |
+
# device_map = {"": 0}
|
19 |
+
# model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-flan-t5-xl",
|
20 |
+
# load_in_8bit=True,
|
21 |
+
# device_map=device_map)
|
22 |
+
# model = PeftModel.from_pretrained(model, model_name)
|
23 |
+
# model = get_peft_model(model, config)
|
24 |
+
|
25 |
+
|
26 |
+
col1, col2 = st.columns(2)
|
27 |
+
with col1:
|
28 |
+
chat = st.text_input("Chat",
|
29 |
+
label_visibility=st.session_state.visibility,
|
30 |
+
disabled=st.session_state.disabled,
|
31 |
+
placeholder=st.session_state.placeholder)
|
32 |
+
|
33 |
+
if chat:
|
34 |
+
st.write("You entered: ", chat)
|
35 |
+
|
blip2_fakenews_all/adapter_config.json
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"base_model_name_or_path": "Salesforce/blip2-flan-t5-xl",
|
3 |
+
"bias": "none",
|
4 |
+
"fan_in_fan_out": false,
|
5 |
+
"inference_mode": true,
|
6 |
+
"init_lora_weights": true,
|
7 |
+
"lora_alpha": 32,
|
8 |
+
"lora_dropout": 0.05,
|
9 |
+
"modules_to_save": null,
|
10 |
+
"peft_type": "LORA",
|
11 |
+
"r": 16,
|
12 |
+
"target_modules": [
|
13 |
+
"q",
|
14 |
+
"v",
|
15 |
+
"q_proj",
|
16 |
+
"v_proj"
|
17 |
+
],
|
18 |
+
"task_type": null
|
19 |
+
}
|
blip2_fakenews_all/adapter_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8070622088e089a1441346f25a6a72624d844fa407e43fe719e914fc43aa8604
|
3 |
+
size 51945733
|