Models Download Script

Hello Everyone,

Here are the scripts for anyone wanting to download all models for offline usage. To use them open the terminal from inside the app and run the script. Feel free to modify the scripts depending on the models and input resolutions you need. Feel free to ask any questions below.

Windows (559 Bytes)
macOS (528 Bytes)

Updated for Video AI 3.2.8

7 Likes

Does this work for 2.6.x? If not - is there a script for 2.6.x?

Hello @suraj , when will we really be entitled to a model manager like in version 2.6.4? You do not provide any answer to this question which is asked by several people among us here that they ask for a return from the model manager so that we can choose our own models that we want and to include the old models artemis, gaia, etc. Thank you for providing us with a clear and clear answer on this question.

5 Likes

No, this is only for the latest version 3.1.9 and above.
Use the model manager to download models for 2.6.4

3 Likes

I currently do not have a timeline for Model Manager. On the GUI side the focus is first to improve preview experience and then add support for frame numbers.

9 Likes

This is what it showed when I ran it.

It’s not put any model files (.tz files) in the C:\ProgramData\Topaz Labs LLC\Topaz Video AI\models folder that I can see (there’s none showing with a last modified date of today’s date).

I also ran it yesterday and there was none showing with current date yesterday. I know there was still models to download because I tried a test of video ai, which said it failed on a model and then I downloaded one that it said it failed on manually. edit: and I’ve run another test of Video AI today and that tries to download a new model too (so there’s still model files needed to download).

Is there a reason why it uses ffmpeg instead of something that just copies (maybe ftp based or http based)? eg. is there a common ftp copy or http copy command that would work better (while still being fast)?

Also couldn’t it specify more clearly what it’s doing? eg. if it’s downloading a file couldn’t it say what file it’s downloading (eg. the name of the ai model and the tile size.tz) and where it’s saving it? Or if it’s skipping one if it already exists couldn’t do that?

It’s not clear what it’s done from the current output really - ie. what files it’s saved, if any. What files it’s skipped because they already exist with up to date versions.

edit: When I was sent it I wasn’t given the instruction that’s shown at the top of this thread which is to "To use them open the terminal from inside the app and run the script. So I’m trying that now. It’s pausing for a while on one line so maybe it’s doing something more. Previously I’d run it from a normal command prompt in the topaz program folder. It would still be more helpful if it said what (if any file it’s downloading though and what it’s skipping.

edit: it’s downloaded one model file now thanks (aaa-v10-fnet-fp16-576x416-2x-ov.tz) but it would be good if it showed more info about what it’s downloading so we can see what it’s downloading (and maybe the bitrate, % complete, filesize). edit: and it’s downloaded some other model files too.

1 Like

I agree. Knowing the progress for the script would be very nice. It’s hard to know if it is doing something right.

1 Like

I noticed that for some download attempts, ffmpeg crashes, but other, that that, the script seems to download the whole pack. :slight_smile:
When the crash occured:
2023-03-27_17h08_21

This should be fixed by the time of 3.2 release
Currently the scripts just use the existing FFmpeg implementation to download the models. Will add some downloading messages.

3 Likes

I would suggest:
At the end of ffmpeg.exe line (-f null -) put the space and the text 2>nul
after line 6 (for %%s in (1, 2, 4) do () put the line
echo %%~i %%~m %%~s

I agree 100%! While I haven’t tried running anything from the command line, last night I loaded a video into Video AI, adjusted my settings, and selected preview. It goes back and forth between downloading model and loading model, but if the app had an indicator bar showing that it was actually downloading a model and when the indicator bar is full, the model has been fully downloaded, it would be extremely helpful. It would also be helpful for troubleshooting purposes. As I mentioned, I tried to upscale a video last night, but it was taking so long to download, I just left it as is and went to bed. This morning it was still saying the same thing, so I’m not sure if it’s having difficulties downloading the models, loading the models, or something else.

You mentioned looking into the models folder in the Topaz Labs LLC/Topaz Video AI folder for a models folder, but after upgrading to v3.2.3 I’ve been unable to upscale any videos and a models folder doesn’t exist within the Topaz Video AI folder.

I’ve been using Topaz products for many years and never had any problems with anything, but starting a couple versions ago I couldn’t render videos using my Nvidia 3080 Ti and now I can’t render videos at all. I was trying to upscale a movie, but just to test it out I loaded a 1MB 320x240 avi video to upscale and the software gets stuck saying downloading model/loading model again. Not sure what’s been going on at Topaz, but the last 3 releases, including v3.2.3, don’t work at all. Prior to this, I’ve never had any issues going all the way back to Topaz Video Enhance AI

1 Like

In Video AI if you go to File->Preferences->Directories it will show you what your models folder is set to (mine’s set to C:\ProgramData\Topaz Labs LLC\Topaz Video AI\models).

You could try using the download script that’s at the top of this thread. I haven’t downloaded the very latest version of it yet. But I found the script only seemed to work when I went in Topaz Video AI to process->open command prompt and started it from there (when I just used a normal command prompt from windows to start it it didn’t seem to work but I may be mistaken). But the download script can take hours/all day downloading a lot of model files for models that you may not need/want (I don’t know if it downloads it for other processors/GPUs and not just those relevant to the ones you have). So generally I use the method of looking in the Video AI log file for the files that it failed on (that have the failed message on) and downloading those in a web browser and saving them to the models folder. Also when I upgrade to a new version I make a backup copy of the models folder and choose the option not to remove the old models (as many of them may not have a newer version and removing them would just mean it would try to redownload them again).

1 Like

I never have any downloading issues for models I have used before, and when updating to the latest version of TVAI, I always choose not to delete anything so whatever I have will stay in the models folder. I also ensure that I am offline before starting any process that I am in a hurry to complete.

TVAI probably tries to check for an updated model but as it can’t do that, it just uses whatever is already in the models folder. If the model it needs isn’t there, obviously the process will fail and i have to go online for TVAI to get it, but that’s not often as I tend to use a fairly limited set of models so it isn’t a problem for me.

I downloaded the script, made sure all the models were in the folder, and made sure the correct folder was set in Preferences, but now I’m receiving an AI error whenever I try rendering a video. I just submitted a bug along with all of my log files. It’s crazy how dependent I’ve become to TVAI! :grin:

For the linux users, I have this shell script:

#!/bin/bash

# Set resolutions
RESOLUTIONS=("480x360" "640x480" "720x480" "768x576" "1280x720" "1920x1080" "3840x2160")

# Set upscaling scales
SCALES=("1" "2" "4")

# Set models
MODELS=("aaa-10" "ahq-12" "alq-13" "alqs-2" "amq-13" "amqs-2" "ddv-3" "dtd-4" "dtds-2" "dtv-4" "dtvs-2" "gcg-5" "ghq-5" "prob-3" "thd-3" "thf-4" "thm-2" "ifi-1" "chf-3" "chr-2" "apo-8" "apf-1")

# Set device
DEVICE=-2

# Loop through models and resolutions
for m in "${MODELS[@]}"
do
  for r in "${RESOLUTIONS[@]}"
  do
    if [[ $m =~ ^if[a-z]{2}-[0-9]$ || $m =~ ^(ch|ap)[rf]-[0-9]$ ]]
    then
      # If it's an interpolation or deblurring model, use different TVAI command
      TVAI_CMD="ffmpeg -nostats -hide_banner -f lavfi -i color=c=red@0.8:duration=0.01:rate=100:size=$r -vf tvai_fi=model=$m:device=$DEVICE:vram=1:instances=0 -f null -"
    else
      # Otherwise, use the upscaling command with all scales
      for s in "${SCALES[@]}"
      do
        TVAI_CMD="ffmpeg -nostats -hide_banner -f lavfi -i color=c=red@0.8:duration=0.01:rate=100:size=$r -vf tvai_up=model=$m:scale=$s:device=$DEVICE:vram=1:instances=0 -f null -"
        echo "Trying command: $TVAI_CMD"
        eval $TVAI_CMD
        # Check if the command failed and download model if it did
        if [ $? -ne 0 ]
        then
          wget -O /root/.config/Topaz\ Labs\ LLC/Topaz\ Video\ Enhance\ AI/models/$m.pth https://cdn.topazlabs.com/resources/models/$m.pth --no-check-certificate
        fi
      done
    fi
  done
done

If anyone can do better or has a suggestion please share.

1 Like

Last night I tried downloading models using this script (I’m on Windows) and on the first attempt my video card’s drivers crashed after a while. So I deleted content of models folder and tried again but I am not confident it downloaded everything.

Can somebody help me, please, and let me know if you right click on models folder that has all of them downloaded and click on ‘Properties’ what does it say how many files that folder has and what is its size in bytes?

P.S. In the absence of better model management tool it would be very nice of Topaz Labs if they could provide list of all model files for each release along with their size and hash info. That way there would be less question marks is something missing after the download and did any corruptions occur during the download.

How exactly do you download models/files using web browser, please?

I run Topaz Video AI and select a video and select the things I want done using the AI models I specify (such as changing the scale with a particular model or increasing the frame rate with one etc.). If it fails (eg. waits for ages on one or more or gives the error message about it) I open the log folder (help->logging->open log folder) then exit the app so that I can open any log file (since it might prevent you if the app has the one you want open) and open the last log file (that has “main” in the filename) in notepad.

In notepad I then do a search for “failed”. If it finds one it should say the URLs of the files that it failed on (if it finds multiple ones you could enter a search that just gets the first failure of each).

eg. I just ran it and this was one of the things in the log file:
...Thread: 24764 Critical Attempt 0 failed for https://veai-models.topazlabs.com /thf-v4-gnet-fp16-576x672-1x-ox.tz

So searching for “0 failed” would find all the failed first attempts to find a particular model file of a particular tile size.

So I can copy the "https://veai-models.topazlabs.com /thf-v4-gnet-fp16-576x672-1x-ox.tz" part and paste it into the URL bar of my browser (eg. Firefox) then remove the space after “.com” then press return and it should then download that file. It asks me where to place it (that might be a preference you need to set up in the browser) and I select to save it in the topaz AI models folder (C:\ProgramData\Topaz Labs LLC\Topaz Video AI\models). So you can do the same thing for the first failed attempt for all the other failed to download files in that log file. Those errors should be in one of the log files that have “main” in their filename.

It might sometimes show a model file failed in the log file when it doesn’t show a “failed” message in the app (if it failed on one or more tile sizes but then loaded a different tile size okay) so you could just check the log file if it spent a long time saying “downloading” but didn’t eventually say it failed in the app - just to see if it had failed on some tile sizes (in which case you could download those manually).

1 Like

Thank you for your prompt and thorough reply. Unfortunately I have ffmpeg crashes whenever I try to run the script and nothing shows up as failed in logs. I will have to ask developer what is going on.

1 Like